pub struct TapRecognizer { /* private fields */ }Expand description
Recognizes a single tap (pointer down + up without significant movement).
The recognizer is button-aware: it only fires when the press button
matches the release button, and only for buttons present in
accept. Default accept is
ButtonMask::PRIMARY — left-click only — which is what users
expect from a “tap” and keeps right-click free for context menus.
Implementations§
Source§impl TapRecognizer
impl TapRecognizer
pub fn new() -> Self
pub fn max_distance(self, d: f32) -> Self
Restrict (or extend) the set of buttons that can fire this
recognizer. Default is ButtonMask::PRIMARY.
Convenience: accept any pointer button.
Trait Implementations§
Source§impl Debug for TapRecognizer
impl Debug for TapRecognizer
Source§impl Default for TapRecognizer
impl Default for TapRecognizer
Source§impl GestureRecognizer for TapRecognizer
impl GestureRecognizer for TapRecognizer
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 TapRecognizer
impl RefUnwindSafe for TapRecognizer
impl Send for TapRecognizer
impl Sync for TapRecognizer
impl Unpin for TapRecognizer
impl UnsafeUnpin for TapRecognizer
impl UnwindSafe for TapRecognizer
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