GoogleChromeLabs / pinch-zoom

Apache License 2.0
372 stars 54 forks source link

Feature request: ability to disable pinch-zooming #11

Open nolanlawson opened 5 years ago

nolanlawson commented 5 years ago

As I describe in this blog post, sometimes it's nice to be able to toggle the pinch-zoom functionality on and off, for instance when the <pinch-zoom> is part of a scrollable list, and you normally want single-pointer events to scroll the list rather than move the zoomable element.

As is, you can simply swap <pinch-zoom> with its contents, but it would be fewer DOM operations to just toggle something like disabled="true" / disabled="false":

<pinch-zoom disabled="true">
  <my-element></my-element>
</pinch-zoom

Presumably this would just attach/unattach the listeners, or have the listeners do nothing, or something like that.

eMarek commented 4 years ago

I would love to have this feature as well. @jakearchibald have you might consider implementing this?

edman007 commented 3 years ago

Hey, I made a pull request to do something like that: https://github.com/GoogleChromeLabs/pinch-zoom/pull/26

with no-default-pan="true" one finger scrolling of the page still works until you start pinch zooming, then it switches behaviours, i also added two-finger-pan="true" which just makes it so one finger scrolling scrolls the page, and two finger pans the element.