voxolith

recogniseGestures()

Recognise taps, double-taps, long-presses, drags, pinches and wheel steps on an input. Tap versus drag is decided on total travel since the pointer went down, so a slow pan still counts as a drag. Several recognisers can share one input: the one with the higher priority hears events first and...

function recogniseGestures(
   input: Input, 
   h: GestureHandlers, 
   opts?: GestureOptions
): Gestures;

Defined in: engine/src/input/gestures.ts:168

Recognise taps, double-taps, long-presses, drags, pinches and wheel steps on an input. Tap versus drag is decided on total travel since the pointer went down, so a slow pan still counts as a drag. Several recognisers can share one input: the one with the higher priority hears events first and can claim a pointer from press or dragStart by returning true.

Parameters

ParameterTypeDescription
inputInputThe surface's input, from createInput.
hGestureHandlersThe handlers to call.
opts?GestureOptions-

Returns

Gestures

A handle to query, disable or dispose the recogniser.

Example

// Beside an orbit controller: a tap picks, a drag still turns the camera.
recogniseGestures(input, { tap: (t) => pick(t.x, t.y) }, { longPressMs: 0 });

On this page