retyui/react-quick-pinch-zoom

how could zoom in / zoom out when

caltamiranob opened this issue · 3 comments

@hello, could you help me with this functionality:

When user press double tap my image scale to 2, next if the user press double tap again then my image scale to 1. There are some event o method to manage these funcionality.

I appreciate your support. Thank you

I'm looking for the same thing - zoom in and out with a double tap.

I tried to do this with the scaleTo method but calling it from the onDoubleTap event breaks the animation logic - the updates are called but they all have a scale of 2 until the last update which has a scale of 1, this felt unresponsive and jerky.

In the end I found a hacky solution by tracking the current scale, setting enabled to false if the scale is max, listen for double tap / click events yourself on nested element and call scaleTo when triggered to zoom out - it works quite well.

In the end I found a hacky solution by tracking the current scale, setting enabled to false if the scale is max, listen for double tap / click events yourself on nested element and call scaleTo when triggered to zoom out - it works quite well.

@8eecf0d2 hey, would you mind sharing the code-snippet for it? I'm currently battling the same issue.

you can try alternative library: https://github.com/prc5/react-zoom-pan-pinch