handleGesture

Commons
stable

Processes a completed touch gesture described by a TTouchWrapper and fires the appropriate directional callback (left, right, up, down) when the swipe distance and ratio meet the threshold. Mutates the wrapper offsetX/offsetY fields in place.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

wrapper
required
TTouchWrapper
A touch state object carrying touchstartX/Y, touchendX/Y, offsetX/Y and optional directional callbacks (left, right, up, down).

API

Return value

The value returned by this util.

Nothing. Fires callback(s) on the wrapper when the gesture threshold is met.

Usage

Examples

Ready-to-paste usage snippets.

Detect a left swipe

typescript