Skip to content

Gracefully handle multi-touch events #54

@CedricReichenbach

Description

@CedricReichenbach

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;

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions