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
| Parameter | Type | Description |
|---|---|---|
input | Input | The surface's input, from createInput. |
h | GestureHandlers | The handlers to call. |
opts? | GestureOptions | - |
Returns
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 });prepareSurface()
Make an element behave as an input surface on touch devices: no browser panning or pinch-zooming over it, no text selection, no tap flash, and (optionally) no context menu, so right-drag can be a gesture. Use this instead of per-app touch-action CSS. DOM-only.
wheelPixels()
Normalise a wheel delta to pixels whatever unit the browser reported it in.