pub struct DoubleTapRecognizer { /* private fields */ }Expand description
Recognizes a double-tap (two taps within a time window and distance, using the same button).
Default accept is ButtonMask::PRIMARY; presses on other buttons
are ignored. Within the recognized sequence, both taps must match
the press button — a Primary then Secondary sequence resets to
the new tap as a fresh “first” rather than firing DoubleTap.
Implementations§
Source§impl DoubleTapRecognizer
impl DoubleTapRecognizer
pub fn new() -> Self
pub fn max_distance(self, d: f32) -> Self
pub fn max_interval(self, interval: Duration) -> Self
Restrict (or extend) the set of buttons that can fire this
recognizer. Default is ButtonMask::PRIMARY.
Convenience: accept any pointer button.
Sourcepub fn process_at(
&mut self,
event: &RawPointerEvent,
now: Instant,
) -> GestureResult
pub fn process_at( &mut self, event: &RawPointerEvent, now: Instant, ) -> GestureResult
Feed an event with an explicit timestamp (for testability without real clocks).
Trait Implementations§
Source§impl Debug for DoubleTapRecognizer
impl Debug for DoubleTapRecognizer
Source§impl Default for DoubleTapRecognizer
impl Default for DoubleTapRecognizer
Source§impl GestureRecognizer for DoubleTapRecognizer
impl GestureRecognizer for DoubleTapRecognizer
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 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.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.Auto Trait Implementations§
impl Freeze for DoubleTapRecognizer
impl RefUnwindSafe for DoubleTapRecognizer
impl Send for DoubleTapRecognizer
impl Sync for DoubleTapRecognizer
impl Unpin for DoubleTapRecognizer
impl UnsafeUnpin for DoubleTapRecognizer
impl UnwindSafe for DoubleTapRecognizer
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