GianlucaGuarini / Tocca.js

Super lightweight script (~1kb) to detect via Javascript events like 'tap' 'dbltap' 'swipeup' 'swipedown' 'swipeleft' 'swiperight' on any kind of device.
http://gianlucaguarini.github.io/Tocca.js/
MIT License
660 stars 60 forks source link

Option "justTouchEvents" doesn't work #58

Closed zipper closed 4 years ago

zipper commented 6 years ago

Regardless of setting "justTouchEvents" to true or false, tap (and other) event is emitted. The reason are these lines of code https://github.com/GianlucaGuarini/Tocca.js/blob/master/Tocca.js#L55-L59. In browser with support for pointer events, event names are set as Pointer* and they are listened to on lines https://github.com/GianlucaGuarini/Tocca.js/blob/master/Tocca.js#L246-L248. Therefore simple code as this results in two logs in console:

$(document).on('tap click', function(e) {
    console.log(e);
});
GianlucaGuarini commented 4 years ago

Please provide a demo showing the issue. I am closing this issue because I don't have enough info to debug it