Closed revonateB0T closed 8 months ago
This is so weird. There are only 2 possible situations when gestureState
can be null:
ZoomableState#resetZoom()
was calledIf a fling was detected then 1
should be impossible. 2
also sounds unlikely because I wasn't able to find any calls to ZoomableState#resetZoom()
in your codebase.
ZoomableNode
is reused in LazyLayout
https://github.com/saket/telephoto/blob/89bedb575e44e1bb945f6b2283c039f38f3e6181/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt#L104
We should update its state
on update
https://github.com/saket/telephoto/blob/89bedb575e44e1bb945f6b2283c039f38f3e6181/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt#L167
https://github.com/saket/telephoto/blob/89bedb575e44e1bb945f6b2283c039f38f3e6181/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt#L105
fun update(
state: RealZoomableState,
enabled: Boolean,
onClick: ((Offset) -> Unit)?,
onLongClick: ((Offset) -> Unit)?,
) {
+ state = state
transformableNode.update(
state = state.transformableState,
canPan = state::canConsumePanChange,
lockRotationOnZoomPan = false,
enabled = enabled,
onTransformStopped = onTransformStopped,
)
tappableAndQuickZoomableNode.update(
onPress = onPress,
onTap = onClick,
onLongPress = onLongClick,
onDoubleTap = onDoubleTap,
onQuickZoomStopped = onQuickZoomStopped,
transformableState = state.transformableState,
gesturesEnabled = enabled,
)
}
Then onTransformStopped
can callback correct RealZoomableState
https://github.com/saket/telephoto/blob/89bedb575e44e1bb945f6b2283c039f38f3e6181/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/Zoomable.kt#L138
@saket
Good catch! Let me fix this. Are you able to consistently reproduce this crash?
1749177719156efe8ed5a7ce8fa15b7f54778f8c was deployed to maven. Can you please try out 0.9.0-SNAPSHOT
?
Good catch! Let me fix this. Are you able to consistently reproduce this crash?
Fixed in 0.9.0-SNAPSHOT, 👍