class SwipeRecognizerBase

Defined at line 25 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.h

SwipeRecognizerBase class is an abstract class that implements most of the

swipe gesture recognition logic for n fingers where n >= 1.

Swipe gestures are directional (up, down, right, or left), so directional recognizers

will inherit from this base class and override the ValidateSwipeSlopeAndDirection()

method, in which the directional differentiation logic is encapsulated.

Public Members

static const float kMinSwipeDistance
static const uint32_t kDefaultNumberOfFingers

Public Methods

void SwipeRecognizerBase (SwipeGestureCallback callback, uint32_t number_of_fingers, zx::duration swipe_gesture_timeout, std::string debug_name)

Timeout is the maximum time a finger can be in contact with the screen to be considered a

swipe. Callback is invoked when swipe gesture is detected and the recognizer is the winner in

gesture arena. |number_of_fingers| is the number of fingers that will be used to perform the

swipe gesture.

Defined at line 31 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.cc

void ~SwipeRecognizerBase ()

Defined at line 38 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.cc

void HandleEvent (const fuchsia::ui::pointer::augment::TouchEventWithLocalHit & event)

Defined at line 40 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.cc

void OnWin ()

Defined at line 126 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.cc

void OnDefeat ()

Defined at line 128 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.cc

void OnContestStarted (std::unique_ptr<ParticipationTokenInterface> token)

Defined at line 173 of file ../../src/ui/a11y/lib/gesture_manager/recognizers_v2/swipe_recognizer_base.cc

std::string DebugName ()

Protected Methods

bool SwipeHasValidSlopeAndDirection (float x_displacement, float y_displacement)

Swipe gestures are directional (up, down, right, or left). In order to be recognized as a

swipe, the slope of the line containing the gesture start and end points must fall within a

specified range, which varies based on the direction of the swipe. Furthermore, the slopes of

the lines containing each touch event location and the gesture start point must also fall

within this range. If a swipe recognizer receives a touch event for which this slope property

does NOT hold, the recognizer will abandon the gesture. Each directional recognizer must

specify the range of acceptable slopes by implementing the method below, which verifies that a

given slope value falls within that range.