pub struct PointerChange {
pub timestamp: Instant,
pub pointer_id: PointerId,
pub content: CursorEventContent,
pub gesture_state: GestureState,
/* private fields */
}Expand description
Represents a single pointer change with timing information.
PointerChange encapsulates all pointer interactions including
presses, releases, and scroll actions. Each event includes a timestamp for
precise timing and ordering of input events.
Fields§
§timestamp: InstantTimestamp indicating when this event occurred.
pointer_id: PointerIdPointer identifier for this input stream.
content: CursorEventContentThe specific type and data of this pointer change.
gesture_state: GestureStateClassification of the gesture associated with this event.
Events originating from touch scrolling will mark this as
GestureState::Dragged, allowing downstream components to
distinguish tap candidates from scroll gestures.
Implementations§
Source§impl PointerChange
impl PointerChange
Sourcepub fn new(
timestamp: Instant,
pointer_id: PointerId,
content: CursorEventContent,
gesture_state: GestureState,
) -> Self
pub fn new( timestamp: Instant, pointer_id: PointerId, content: CursorEventContent, gesture_state: GestureState, ) -> Self
Creates an unconsumed pointer sample with an explicit event timestamp.
Sourcepub fn with_position(self, position: impl Into<Option<PxPosition>>) -> Self
pub fn with_position(self, position: impl Into<Option<PxPosition>>) -> Self
Associates the sample with its window position at the time of input.
Passing None records an unavailable position rather than using a later
cursor location. Movement events always use their own coordinates.
Sourcepub fn position(&self) -> Option<PxPosition>
pub fn position(&self) -> Option<PxPosition>
Returns the sample’s recorded absolute position, when available.
Sourcepub fn is_discrete_scroll(&self) -> bool
pub fn is_discrete_scroll(&self) -> bool
Returns whether this scroll sample represents a discrete wheel step.
The classification follows the original input when an ancestor receives a smaller remainder or a different coordinate space.
Sourcepub fn is_consumed(&self) -> bool
pub fn is_consumed(&self) -> bool
Returns whether this change has already been consumed.
Sourcepub fn claim_tap_press(&mut self) -> bool
pub fn claim_tap_press(&mut self) -> bool
Claims a press for one tap recognizer without consuming the sample.
Returns false for a non-press sample or a press already claimed by
another recognizer. Drag and scroll observers can still inspect it.
Trait Implementations§
Source§impl Clone for PointerChange
impl Clone for PointerChange
Source§fn clone(&self) -> PointerChange
fn clone(&self) -> PointerChange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PointerChange
impl RefUnwindSafe for PointerChange
impl Send for PointerChange
impl Sync for PointerChange
impl Unpin for PointerChange
impl UnsafeUnpin for PointerChange
impl UnwindSafe for PointerChange
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.