anvaka / panzoom

Universal pan and zoom library (DOM, SVG, Custom)
https://anvaka.github.io/panzoom/demo/attach-via-script.html
MIT License
1.79k stars 287 forks source link

Improve the accuracy of the docs for beforeMouseDown #285

Closed stampyzfanz closed 2 years ago

stampyzfanz commented 2 years ago

There was a bug in an application I was working on where I used beforeMouseDown to disable panning and it was very hard to debug why it still panned using touch. This change will allow users to know exactly what beforeMouseDown does. Evidence that it doesn't disable panning using touch located in this fiddle: https://jsfiddle.net/thg2brxe/.

anvaka commented 2 years ago

Thank you for your comment. I agree, the API is not symmetrical which can lead to unmet expectations. We could add beforeTouchDown() to make it symmetrical - would this help?

taibhse-designs commented 2 years ago

Thank you for your comment. I agree, the API is not symmetrical which can lead to unmet expectations. We could add beforeTouchDown() to make it symmetrical - would this help?

For an application I am building, beforeTouchDown would be highly appreciated, I need to be able to disable panning on touch devices unless my canvas has been zoomed into, or atleast be able to disable left right panning,

stampyzfanz commented 2 years ago

Im my project, I ended up editing the source code to get the beforeMouseDown check to both touch events and scroll events. I didn't want the user to be able to pan in any way or scroll while hovering over a button.

Adding a beforeTouchDown would be helpful would assist in this, yes.