jquery.finger
jquery.finger copied to clipboard
Gracefully handle multi-touch events
Currently, it's implicitly assumed there's only a maximum of one touch active at any time, leading to unexpected behaviour when e.g. tapping with a second finger while dragging (drag is cancelled, but end event never fired).
The most simple workaround would be to simply ignore any additional touches and prevent them from interfering with the current state. This would be quite straightforward with two guards, in the start and stop handlers respectively:
Top of startHandler, after left/right mouse button test:
// ignore additional touches
if (hasTouch && event.originalEvent.touches.length > 1)
return;
Top of stopHandler, after clearing timeout:
// ignore lifting of additional touches (multitouch)
if (hasTouch && event.originalEvent.touches.length > 0)
return;
Thanks for the proposal 👍 Would you mind opening a PR for this?