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

Double clicking to zoom, in quick succession causes the element to pan randomly

Open Tom-Keeley opened this issue 1 year ago • 5 comments

Describe the bug When double clicking to zoom in, if done repeatedly and in slightly different places on the element it causes the element to pan to a random position.

I initially thought it may be an issue specific to the project I am working on but the bug is reproducible within the documentation page - I have attached a video demonstrating this.

https://github.com/prc5/react-zoom-pan-pinch/assets/55388271/a63f7ba9-8893-4608-945d-8143752a5162

I have noticed the issue occurs more consistently when using a trackpad rather than a mouse but that may be due to my machine, i have also noticed that occasionally it will pan to the same position.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://prc5.github.io/react-zoom-pan-pinch/?path=/story/examples-zoomed-out--zoomed-out
  2. Double click to zoom in in quick succession slightly changing where you are clicking each time
  3. After a random number of times the element will pan unexpectedly to a random position.

Expected behavior When double clicking irregardless of how fast the user is doing it, it should zoom in to where the user has double clicked. This may include some minor panning but it should not pan to a random position.

Desktop (please complete the following information):

  • OS: MacOS Ventura
  • Browser: Chrome
  • Version: 115.0.5790.102 (Official Build) (arm64)

Additional context This also occurs in the other examples on the documentation site not just the one shown in the video.

Tom-Keeley avatar Aug 10 '23 14:08 Tom-Keeley

facing the same problem 😢 but it seems zoom in in either way (double click, trackpad gesture zoom in, mouse wheel zoom in ), then click (no need to be double click), could reproduce the behavior.

OS: MacOS Monterey Browser: Chrome

Neilxx avatar Nov 17 '23 15:11 Neilxx

I noticed that this issue is only happening when the limitToBounds on the TransformWrapper is set to false.

edwinvanderven avatar Dec 07 '23 13:12 edwinvanderven

disable the velocity option on panning it works

SiavashAliyari avatar Apr 19 '24 13:04 SiavashAliyari

Facing the same problem. Anyone has solutions to this?

diasmashikov avatar Jun 26 '24 00:06 diasmashikov