Class: SingleGesture

player/TouchGestures~SingleGesture(touches)

Handles single touch gestures.

Single touch gestures are swipes controlling navigation. A Swipe is detected either as a quick flick (any/very short minimum length within restricted time or a slow movement across the screen (any time but minimum length of movement). Swipes are accepted in both vertical and horizontal direction. Only one swipe is performed however, determined by the dominant direction (longer absolute length in px).

Constructor

new SingleGesture(touches)

Creates a new single touch gesture handler.

Parameters:
Name Type Description
touches Array.<object>

The initial touchpoint objects when the gesture is first detected

Source:

Extends

  • module:player/TouchGestures-Gesture

Methods

doSwipe(direction)

Performs a swipe.

Parameters:
Name Type Description
direction string

Currently recognized "up", "down", "left", "right"

Source:

finish()

Check quick swipe when the touchpint is released from the screen.

A quick swipe happend, when the last movement before release was a quick flick in one direction. The touchpoint has to be moved for a certain distance within a short timeframe right before release.

Source:

move(touches)

Checks for long swipes when the touch point moves.

Also updates the last touch value to check quick swipes when gesture is finished.

Parameters:
Name Type Description
touches Array.<object>

The touchpoints.

Source: