pub struct GestureRecognizer { /* private fields */ }Expand description
Stateful gesture recognizer that transforms raw events into semantic events.
Call process for each incoming Event.
Call check_long_press periodically
(e.g., on tick) to detect long-press gestures.
Implementations§
Source§impl GestureRecognizer
impl GestureRecognizer
Sourcepub fn new(config: GestureConfig) -> Self
pub fn new(config: GestureConfig) -> Self
Create a new gesture recognizer with the given configuration.
Sourcepub fn process(&mut self, event: &Event, now: Instant) -> Vec<SemanticEvent>
pub fn process(&mut self, event: &Event, now: Instant) -> Vec<SemanticEvent>
Process a raw event, returning any semantic events produced.
Most events produce 0 or 1 semantic events. A mouse-up after a
multi-click sequence may produce both a Click and a DoubleClick.
Sourcepub fn check_long_press(&mut self, now: Instant) -> Option<SemanticEvent>
pub fn check_long_press(&mut self, now: Instant) -> Option<SemanticEvent>
Check for long press timeout. Call periodically (e.g., on tick).
Returns Some(LongPress { .. }) if the mouse has been held stationary
beyond the configured threshold.
Sourcepub fn is_dragging(&self) -> bool
pub fn is_dragging(&self) -> bool
Whether a drag is currently in progress.
Sourcepub fn config(&self) -> &GestureConfig
pub fn config(&self) -> &GestureConfig
Get a reference to the current configuration.
Sourcepub fn set_config(&mut self, config: GestureConfig)
pub fn set_config(&mut self, config: GestureConfig)
Update the configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GestureRecognizer
impl RefUnwindSafe for GestureRecognizer
impl Send for GestureRecognizer
impl Sync for GestureRecognizer
impl Unpin for GestureRecognizer
impl UnsafeUnpin for GestureRecognizer
impl UnwindSafe for GestureRecognizer
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