Skip to content

Commit f4b2f8c

Browse files
committed
Add WithRawSpec
1 parent 9cb8ca6 commit f4b2f8c

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ androidx.compose.bom=2025.08.00
2323
androidx.activity.compose=1.10.1
2424

2525
#Versions
26+
27+
# Beware of the versions in IDEA platform
28+
# The list of 3rd party libraries used in the IDEA platform: https://www.jetbrains.com/legal/third-party-software/?product=IIU
29+
2630
# KMP is not compatible with AGP 8.3 yet.
2731
compose.version=1.8.2
2832
skiko.version=0.9.4.2
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (c) 2025 JetBrains s.r.o.
3+
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
4+
*/
5+
6+
package org.jetbrains.letsPlot.skia.compose
7+
8+
9+
interface WithRawSpec {
10+
val rawSpec: MutableMap<String, Any>
11+
}

lets-plot-compose/src/desktopMain/kotlin/org/jetbrains/letsPlot/skia/compose/PlotPanel.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ actual fun PlotPanel(
4141
// Update density on each recomposition to handle monitor DPI changes (e.g., drag between HIDPI/regular monitor)
4242
val density = LocalDensity.current.density.toDouble()
4343

44-
// Cache processed plot spec to avoid reprocessing the same figure on every recomposition.
45-
val processedPlotSpec by remember(figure) { mutableStateOf(processRawSpecs(figure.toSpec(), frontendOnly = false)) }
44+
// Cache plot processed spec to avoid reprocessing the same figure on every recomposition.
45+
val processedPlotSpec by remember(figure) {
46+
val rawSpec = when (figure) {
47+
is WithRawSpec -> figure.rawSpec
48+
else -> figure.toSpec()
49+
}
50+
mutableStateOf(processRawSpecs(rawSpec, frontendOnly = false))
51+
}
4652
var panelSize by remember { mutableStateOf(DoubleVector.ZERO) }
4753
var dispatchComputationMessages by remember { mutableStateOf(true) }
4854
var specOverrideList by remember { mutableStateOf(emptyList<Map<String, Any>>()) }

0 commit comments

Comments
 (0)