timmywil / panzoom

A library for panning and zooming elements using CSS transforms :mag:

Home Page:https://timmywil.com/panzoom/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pinch and pan simultaneously

seme1 opened this issue · comments

commented

Describe the bug

I had an old version of panzoom (jquery plugin) that worked without any issues. After upgrading to the new non-jquery panzoom, I'm no longer able to pinch and pan the image in the same time.

Below videos show the behavior in the old panzoom
https://www.youtube.com/shorts/KJRl4xU--FY?feature=share

And the behavior in the new version of panzoom
https://www.youtube.com/shorts/FhQcH7fGCw0

It would be appreciated to illustrate how to replicate the old behavior with the new version of panzoom (if at all possible). If not, what are my best alternatives ? I am forced to upgrade as the old version is giving too many errors in the console of new Chrome about touch events being ignored while scrolling (even though it works without any issues).

Thanks for opening an issue. That behavior was removed recently. Specifically, in version 4.4.1. It was done to fix this issue. The new version of Panzoom relies fully on the browser for dimensions of the panzoom element, which was not true of the old jQuery plugin. This solved a lot of other issues and significantly reduced code complexity, but means that changes need to be painted before another change can be made. That's fine in most cases, except for something like this, where the goal would be to both zoom to a point between two fingers and pan it if those fingers move. That said, I wonder if there's a way to accomplish in the current version. But first, please try version 4.4.0 and see if that works for your use case.

I will reopen if any code changes come from this.

I'll add votes needed to gauge interest in this behavior. Some people don't like it.

commented

Thank you very much for the fast response. I just tried version 4.4.0 and it worked perfectly fine (with the desired behavior).
Perhaps an option to disable the fix introduced in this issue would help in future versions of panzoom ?

I thought about this more. I was originally thinking of #512 as a bug fix, but it did change behavior. You could argue I should have done a major release. To that end, I'll add an option to 4.4.x to put this behavior back. I can't promise the option won't get removed in a future major version. It depends on whether I can get it to work for the use case in the #512.