svgdotjs / svg.panzoom.js

A plugin for svg.js which enables panzoom for viewbox elements
MIT License
95 stars 54 forks source link

wheelZoom ev.deltaY can be -0 #5

Closed dotnetCarpenter closed 7 years ago

dotnetCarpenter commented 7 years ago

When using a laptop touchpad, it's common that ev.deltaY is -0, which gives a zoomAmount of NaN.

There is two resolutions, one is to ignore wheelZoom when ev.deltaY is -0 another is to allow wheelZoom on another axis. The former is the quick fix which I will try to get away with. But perhaps it makes sense to support other axis wheelZoom?

Fuzzyma commented 7 years ago

On my laptop its working nicely. Having -0 basically means there was no scroll. So we dont need to scroll.

Zoom is always on the y axis in all applications I know. Do you know an application where something is zoomed on x zoom?

dotnetCarpenter commented 7 years ago

On my acer and on a collegue of mine's powerbook, it happens almost instantly.

I will just add if(ev.deltaY == 0) return to wheelZoom.