pub struct PointerEvent {
pub id: PointerId,
pub kind: PointerEventKind,
pub phase: PointerPhase,
pub position: Point,
pub global_position: Point,
pub buttons: PointerButtons,
/* private fields */
}Expand description
Pointer event with consumption tracking for gesture disambiguation.
Events can be consumed by handlers (e.g., scroll) to prevent other handlers (e.g., clicks) from receiving them. This enables proper gesture disambiguation matching Jetpack Compose’s event consumption pattern.
Fields§
§id: PointerId§kind: PointerEventKind§phase: PointerPhase§position: Point§global_position: PointImplementations§
Source§impl PointerEvent
impl PointerEvent
pub fn new( kind: PointerEventKind, position: Point, global_position: Point, ) -> Self
Set the buttons state for this event
Sourcepub fn consume(&self)
pub fn consume(&self)
Mark this event as consumed, preventing other handlers from processing it.
Example: Scroll gestures consume events once dragging starts to prevent child buttons from firing clicks.
Sourcepub fn is_consumed(&self) -> bool
pub fn is_consumed(&self) -> bool
Check if this event has been consumed by another handler.
Handlers should check this before processing events. For example, clickable should not fire if the event was consumed by a scroll gesture.
Sourcepub fn copy_with_local_position(&self, position: Point) -> Self
pub fn copy_with_local_position(&self, position: Point) -> Self
Creates a copy of this event with a new local position, sharing the consumption state.
Trait Implementations§
Source§impl Clone for PointerEvent
impl Clone for PointerEvent
Source§fn clone(&self) -> PointerEvent
fn clone(&self) -> PointerEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more