jquery.finger icon indicating copy to clipboard operation
jquery.finger copied to clipboard

Gracefully handle multi-touch events

Open CedricReichenbach opened this issue 8 years ago • 1 comments

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;

CedricReichenbach avatar Apr 23 '17 21:04 CedricReichenbach

Thanks for the proposal 👍 Would you mind opening a PR for this?

ngryman avatar Apr 28 '17 21:04 ngryman