drozhzhin-n-e / vue-pinch-zoom

Vue library for images scaling and dragging with touch screen gestures.
http://ivylab.space/pinch-zoom/vue
Apache License 2.0
56 stars 29 forks source link

Pass event as argument to detectTap to avoid errors on some legacy firefox versions #12

Open j0Shi82 opened 4 years ago

j0Shi82 commented 4 years ago

The plugin is currently throwing errors on some legacy Firefox versions:

ReferenceError: event is not defined

The issue is the function detectTap that gets called from onmouseup events. Since event is not defined within the function scope, it looks up window.event instead. It works on most browsers, but we're getting errors on some legacy Firefox versions where window.event is unsupported or bugged and returns undefined, causing the error.

I think it would be better to pass event as an argument to detectTap. This would also be consistent with how the rest of the code is structured, so I guess this is simply an oversight? Either way, relying on window.event is not recommended: https://developer.mozilla.org/en-US/docs/Web/API/Window/event

Cheers!