react-zoom-pan-pinch icon indicating copy to clipboard operation
react-zoom-pan-pinch copied to clipboard

Sync zooming, panning and pinching

Open demonmovch opened this issue 5 years ago • 2 comments

Hello. Thanks for the great package. Is it possible to zoom, pan and pinch two images simultaneously so when I zoom one image the other one will take the same position or scale. I was not able to implement this on my own. Do you have any example or advice?

demonmovch avatar Aug 19 '20 13:08 demonmovch

Maybe you can use my answer to #159 I hope can help you

saidmoya12 avatar Jul 07 '21 16:07 saidmoya12

Is it possible in version 2.1.3? I cannot find soultion in a previous issue.

kimohyeong avatar Nov 23 '21 11:11 kimohyeong

Yes, we can do it via ref, where we can access current values for scale and position so you can add it via css with translate and scale properties. The other way is to wrap page with the wrapper, so you can access it's values with hooks

prc5 avatar Feb 27 '23 16:02 prc5

Does someone has snippet example of making this feature? It seems like using hooks is the right way to go, but I am unable to make it work.

rafyzg avatar May 27 '23 16:05 rafyzg

Hey @rafyzg, recently I'm my job I had to build a component where 4 images are in zoom and pan sync. Just built this sandbox with the solution I found. In the Hope it helps you!

https://codesandbox.io/s/red-monad-kbj1lr?file=/src/App.tsx

RodrigoGarciaLab avatar May 31 '23 09:05 RodrigoGarciaLab

@RodrigoGarciaLab Thank you very much!

rafyzg avatar May 31 '23 11:05 rafyzg