pub struct LongPressRecognizer { /* private fields */ }Expand description
Stateful long-press gesture recognizer.
Implementations§
Source§impl LongPressRecognizer
impl LongPressRecognizer
Sourcepub fn new(settings: LongPressSettings) -> Self
pub fn new(settings: LongPressSettings) -> Self
Creates a long-press recognizer with custom settings.
Sourcepub fn update(
&mut self,
pass: PointerEventPass,
pointer_changes: &mut [PointerChange],
within_bounds: bool,
) -> LongPressResult
pub fn update( &mut self, pass: PointerEventPass, pointer_changes: &mut [PointerChange], within_bounds: bool, ) -> LongPressResult
Updates the recognizer with the current pointer pass and events.
§Slop origin
The recorded press position anchors slop and movement. A press without a recorded position uses the first movement sample as its origin.
§within_bounds
within_bounds is a semantic flag the caller computes from the node’s
relative coordinates; it reports whether the pointer was inside this
node when the update ran.
Sourcepub fn update_at_frame_nanos(
&mut self,
pass: PointerEventPass,
pointer_changes: &mut [PointerChange],
within_bounds: bool,
frame_nanos: u64,
) -> LongPressResult
pub fn update_at_frame_nanos( &mut self, pass: PointerEventPass, pointer_changes: &mut [PointerChange], within_bounds: bool, frame_nanos: u64, ) -> LongPressResult
Updates a press using the UI frame clock, including final-pass drag cancellation.
Sourcepub fn update_after_tap(
&mut self,
pass: PointerEventPass,
pointer_changes: &mut [PointerChange],
within_bounds: bool,
frame_nanos: u64,
tap: TapResult,
) -> LongPressResult
pub fn update_after_tap( &mut self, pass: PointerEventPass, pointer_changes: &mut [PointerChange], within_bounds: bool, frame_nanos: u64, tap: TapResult, ) -> LongPressResult
Observes the samples belonging to the supplied tap result, including consumed releases.
Sourcepub fn needs_frame(&self) -> bool
pub fn needs_frame(&self) -> bool
Reports whether a frame-clock press still needs its deadline checked.
Sourcepub fn has_triggered(&self) -> bool
pub fn has_triggered(&self) -> bool
Reports whether the current press has already triggered.
Sourcepub fn advance_frame_nanos(&mut self, frame_nanos: u64) -> bool
pub fn advance_frame_nanos(&mut self, frame_nanos: u64) -> bool
Advances a stationary press and returns true only at its first deadline.
Trait Implementations§
Source§impl Clone for LongPressRecognizer
impl Clone for LongPressRecognizer
Source§fn clone(&self) -> LongPressRecognizer
fn clone(&self) -> LongPressRecognizer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LongPressRecognizer
Source§impl Debug for LongPressRecognizer
impl Debug for LongPressRecognizer
Source§impl Default for LongPressRecognizer
impl Default for LongPressRecognizer
Source§fn default() -> LongPressRecognizer
fn default() -> LongPressRecognizer
Source§impl PartialEq for LongPressRecognizer
impl PartialEq for LongPressRecognizer
impl StructuralPartialEq for LongPressRecognizer
Auto Trait Implementations§
impl Freeze for LongPressRecognizer
impl RefUnwindSafe for LongPressRecognizer
impl Send for LongPressRecognizer
impl Sync for LongPressRecognizer
impl Unpin for LongPressRecognizer
impl UnsafeUnpin for LongPressRecognizer
impl UnwindSafe for LongPressRecognizer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.