Skip to main content

SwipeRecognizer

Struct SwipeRecognizer 

Source
pub struct SwipeRecognizer { /* private fields */ }
Expand description

Recognizes a swipe gesture (quick directional movement above velocity threshold).

Implementations§

Source§

impl SwipeRecognizer

Source

pub fn new() -> Self

Source

pub fn min_velocity(self, v: f32) -> Self

Source

pub fn min_distance(self, d: f32) -> Self

Source

pub fn process_at( &mut self, event: &RawPointerEvent, now: Instant, ) -> GestureResult

Process with an explicit timestamp for testability.

Trait Implementations§

Source§

impl Debug for SwipeRecognizer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SwipeRecognizer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GestureRecognizer for SwipeRecognizer

Source§

fn process(&mut self, event: &RawPointerEvent) -> GestureResult

Feed a raw pointer event and return the recognition result.
Source§

fn reset(&mut self)

Reset the recognizer to its initial state.
Source§

fn priority(&self) -> u32

Priority for arbitration when multiple recognizers compete. Higher priority wins.
Source§

fn tick(&mut self, _now: Instant) -> GestureResult

Advance any time-driven state (e.g. long-press elapsed timer). Default is a no-op — only recognizers that depend on wall-clock time (like LongPressRecognizer) override this.
Source§

fn next_deadline(&self) -> Option<Instant>

Earliest future Instant at which calling GestureRecognizer::tick could transition the recognizer into Recognized or Failed. Returns None when the recognizer is idle or not time-driven. Used by the event loop to schedule a wake-up before a long-press fires.
Source§

fn resets_on_peer_recognition(&self) -> bool

Whether this recognizer should be reset when a peer wins arbitration in the same GestureArena::process call. The default is true — winner-take-all, the usual behaviour for mutually exclusive gestures (tap vs drag, long-press vs tap). Multi-tap recognizers (DoubleTapRecognizer, TripleTapRecognizer) override this to false so a DoubleTap firing at click 2 does not wipe the TripleTapRecognizer’s accumulated state before click 3 arrives.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.