Skip to main content
Version: 3.x

Handler State

Gesture handlers can be treated as "state machines". At any given time, each handler instance has an assigned state that can change when new touch events occur or can be forced to change by the touch system in certain circumstances.

States manage the internal recognition process. You can hook into these transitions using specific gesture callbacks.

StateDescriptionCallback
UNDETERMINEDThe default initial state of every handler.
BEGANThe handler has started receiving touch data but hasn't yet met the activation criteria.onBegin
ACTIVEThe gesture is recognized and activation criteria are met.onActivate when it first transitions into the ACTIVE state.

onUpdate when it has new data about the gesture.
ENDThe user successfully completed the gesture.onDeactivate with event.canceled set to false.

onFinalize with event.canceled set to false.
FAILEDThe handler failed to recognize the gesture.onDeactivate if the gesture was in ACTIVE state before, with event.canceled set to true.

onFinalize with event.canceled set to true.
CANCELLEDThe system interrupted the gesture.onDeactivate if the gesture was in ACTIVE state before, with event.canceled set to true.

onFinalize with event.canceled set to true.

State flows

The most typical flow of state is when a gesture picks up on an initial touch event, then recognizes it, then acknowledges its ending and resets itself back to the initial state. Drag or hold the circle below to see how each state machine reacts.

We are Software Mansion.