Is it possible to disable "Reset zoom and snap back to initial position on gesture end"
fakeheal opened this issue · 3 comments
The title pretty much sums my question/feature request. How can I remove resetting the zoom/pan state when any of the gesture end? I want to be able to continue zooming until maxZoom
is reached. I tried removing the code in onFinish
, but with no success.
Also, I am interested in using this zoom functionality with other <View>
s besides <Image>
, would you be open to a PR with such functionality?
Edit: I am able to preserve last zoomed value, but not position by introducing a new:
const lastScale = useSharedValue(1);
//...
const pinchHandler = useAnimatedGestureHandler({
//...
onActive: event => {
//...
scale.value = clamp(event.scale * lastScale.value, minScale, maxScale);
//...
},
onFinish: () => {
//...
lastScale.value = scale.value;
//...
}
})
Actually, your package is great 👏 as it is.
I went ahead and created a package that solves my use case, so I am going to close this issue.
I'm wondering if this can be done as well, @likashefqet? Unfortunately, @fakeheal's package does not work for me