pub struct PointerSample {
pub pointer: PointerInfo,
pub phase: PointerPhase,
pub position: Point,
pub button: Option<PointerButton>,
pub modifiers: Modifiers,
pub coalesced: Vec<CoalescedSample>,
}Expand description
One pointer sample as it enters the tree.
The unit WidgetTree::dispatch_pointer
consumes. A backend produces exactly one of these per OS packet, folding any
intermediate positions the OS batched into coalesced.
Fields§
§pointer: PointerInfoWho is pointing.
phase: PointerPhaseWhat happened.
position: PointWhere, in window-logical coordinates.
The button that changed on a Down or
Up. None for a move, a cancel, and for a
buttonless direct-pointer contact.
modifiers: ModifiersModifier keys held when the sample was produced.
coalesced: Vec<CoalescedSample>Positions the OS batched into this packet, oldest first, excluding
position (which is the newest).
A velocity tracker integrates over these; a drawing surface draws
through them; everything else ignores them. Deliberately a Vec and not
a SmallVec: this costs one allocation per packet that actually
coalesced, and teksilo-core’s dependency set is small on purpose.
Reaches a handler as EventContext::coalesced.
Implementations§
Source§impl PointerSample
impl PointerSample
Sourcepub fn mouse(phase: PointerPhase, position: Point, time: EventTime) -> Self
pub fn mouse(phase: PointerPhase, position: Point, time: EventTime) -> Self
A mouse sample with no coalesced history — the shape every legacy
WidgetEvent lowers to.
This sample with button recorded as the button that changed.
Sourcepub fn with_modifiers(self, modifiers: Modifiers) -> Self
pub fn with_modifiers(self, modifiers: Modifiers) -> Self
This sample with modifiers recorded.