mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(charts): hoist rememberVicoZoomState above vararg layers to prevent ClassCastException (#5060)
This commit is contained in:
parent
9c8532f80d
commit
37e9e2c8f0
1 changed files with 6 additions and 1 deletions
|
|
@ -96,6 +96,11 @@ fun GenericMetricChart(
|
|||
onPointSelected: ((Double) -> Unit)? = null,
|
||||
vicoScrollState: VicoScrollState = rememberVicoScrollState(),
|
||||
) {
|
||||
// Hoist zoom state above rememberCartesianChart so that the variable slot count
|
||||
// from the vararg layers spread does not shift this remember call during recomposition
|
||||
// (toggling legend chips changes the layer count, which corrupts the slot table).
|
||||
val zoomState = rememberVicoZoomState(zoomEnabled = true, initialZoom = Zoom.Content)
|
||||
|
||||
val markerVisibilityListener =
|
||||
remember(onPointSelected) {
|
||||
object : CartesianMarkerVisibilityListener {
|
||||
|
|
@ -126,7 +131,7 @@ fun GenericMetricChart(
|
|||
modelProducer = modelProducer,
|
||||
modifier = modifier,
|
||||
scrollState = vicoScrollState,
|
||||
zoomState = rememberVicoZoomState(zoomEnabled = true, initialZoom = Zoom.Content),
|
||||
zoomState = zoomState,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue