class GestureRecognizer

Defined at line 34 of file ../../src/ui/a11y/lib/gesture_manager/arena/recognizer.h

A Gesture Recognizer interface for accessibility services.

Gesture Recognizers provide semantic meaning to a sequence of raw pointer events by defining and

detecting a gesture. Recognizers are added to an arena, which manages which recognizer will be

the winner for that contest. The lifecycle of a recognizer could be simplified as follows:

- The recognizer adds itself to the arena via GestureArena::Add().

- As an interaction with the touch screen happens, it will first receive a

|ContestMember| object from |OnContestStarted|, which allows the recognizer to subscribe

to events and mark acceptance or rejection.

- Recognizers can then have four main states: not started, possible gesture, not possible,

detected.

- The recognizer can claim a win or declare defeat via the |ContestMember| depending on which

state it's in. Declarations of defeat are handled immediately, while win claimers may be

awarded win or defeat by the arena.

- This recognizer will continue receiving pointer events until it releases the

|ContestMember| or is defeated. A new contest starts on the first interaction after the

winner releases its |ContestMember|.

Public Methods

void ~GestureRecognizer ()

Defined at line 11 of file ../../src/ui/a11y/lib/gesture_manager/arena/recognizer.cc

void OnWin ()

This method gets called when the recognizer has won the arena. The default implementation does

nothing.

Defined at line 13 of file ../../src/ui/a11y/lib/gesture_manager/arena/recognizer.cc

void OnDefeat ()

This method gets called when the recognizer has lost the arena. The default implementation does

nothing.

Defined at line 14 of file ../../src/ui/a11y/lib/gesture_manager/arena/recognizer.cc

void OnContestStarted (std::unique_ptr<ContestMember> contest_member)

This method gets called when the arena starts a new contest. The implementation should set a

callback on the provided |ContestMember| and indicate when it accepts or rejects the

gesture, releasing the |ContestMember| when it no longer cares about it.

void HandleEvent (const fuchsia::ui::input::accessibility::PointerEvent & pointer_event)

Non-defeated recognizers holding a |ContestMember| will receive a call to |HandleEvent|

whenever a new pointer event arrives in the arena.

std::string DebugName ()

A human-readable string name for the recognizer to be used in logs only, e.g. OneTapRecognizer.