timmywil / panzoom

A library for panning and zooming elements using CSS transforms :mag:
https://timmywil.com/panzoom/
MIT License
2.14k stars 416 forks source link

Location element wrong offset X, Y when start pan #629

Closed isthaison closed 2 years ago

isthaison commented 2 years ago

Describe the bug

A Panzoom instance within another Panzoom instance Location element wrong offset X, Y when start pan, It's happen after parent change zoom

Steps to reproduce

Code example https://github.com/isthaison/panzoom/blob/main/demo/examples/PanzoomWithinPanzoom.tsx

screen-capture.webm

timmywil commented 2 years ago

Thanks for opening an issue. I see you've added wheel zooming, but you'll need to update the pan of panzoom2 whenever the scale changes for panzoom1 (see adjustScale for an example). I think that's why you're getting the jumps. Hope that helps!