pub struct SwipeRecognizer { /* private fields */ }Expand description
Recognizes a swipe gesture (quick directional movement above velocity threshold).
Implementations§
Source§impl SwipeRecognizer
impl SwipeRecognizer
pub fn new() -> Self
pub fn min_velocity(self, v: f32) -> Self
pub fn min_distance(self, d: f32) -> Self
Sourcepub fn process_at(
&mut self,
event: &RawPointerEvent,
now: Instant,
) -> GestureResult
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
impl Debug for SwipeRecognizer
Source§impl Default for SwipeRecognizer
impl Default for SwipeRecognizer
Source§impl GestureRecognizer for SwipeRecognizer
impl GestureRecognizer for SwipeRecognizer
Source§fn process(&mut self, event: &RawPointerEvent) -> GestureResult
fn process(&mut self, event: &RawPointerEvent) -> GestureResult
Feed a raw pointer event and return the recognition result.
Source§fn priority(&self) -> u32
fn priority(&self) -> u32
Priority for arbitration when multiple recognizers compete.
Higher priority wins.
Source§fn tick(&mut self, _now: Instant) -> GestureResult
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>
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
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§
impl Freeze for SwipeRecognizer
impl RefUnwindSafe for SwipeRecognizer
impl Send for SwipeRecognizer
impl Sync for SwipeRecognizer
impl Unpin for SwipeRecognizer
impl UnsafeUnpin for SwipeRecognizer
impl UnwindSafe for SwipeRecognizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more