pub struct PointerTable { /* private fields */ }Expand description
Fixed-capacity active pointer table (see the module docs).
Implementations§
Source§impl PointerTable
impl PointerTable
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
Sourcepub fn set_limit(&mut self, limit: usize)
pub fn set_limit(&mut self, limit: usize)
Caps simultaneously tracked pointers (1..=MAX_ACTIVE_POINTERS); live slots stay.
pub fn get(&self, key: PointerKey) -> Option<&PointerSlot>
pub fn get_mut(&mut self, key: PointerKey) -> Option<&mut PointerSlot>
Sourcepub fn iter(&self) -> impl Iterator<Item = &PointerSlot>
pub fn iter(&self) -> impl Iterator<Item = &PointerSlot>
Live slots in slot order.
Sourcepub fn primary(&self) -> Option<&PointerSlot>
pub fn primary(&self) -> Option<&PointerSlot>
The first active primary slot.
Sourcepub fn would_be_primary(&self, key: PointerKey) -> bool
pub fn would_be_primary(&self, key: PointerKey) -> bool
W3C primary rule: the mouse is always primary; a pen or touch contact is primary when no other pointer of its kind is active.
Sourcepub fn begin(
&mut self,
key: PointerKey,
at: [f32; 2],
ts: TimestampUs,
target: NodeId,
) -> Result<&mut PointerSlot, PointerOverflow>
pub fn begin( &mut self, key: PointerKey, at: [f32; 2], ts: TimestampUs, target: NodeId, ) -> Result<&mut PointerSlot, PointerOverflow>
Activates key (no-op returning the slot when already active).
Sourcepub fn end(&mut self, key: PointerKey) -> Option<PointerSlot>
pub fn end(&mut self, key: PointerKey) -> Option<PointerSlot>
Ends key, returning its final slot.
Sourcepub fn capture_now(
&mut self,
key: PointerKey,
node: NodeId,
claimed: bool,
) -> Result<(), CaptureError>
pub fn capture_now( &mut self, key: PointerKey, node: NodeId, claimed: bool, ) -> Result<(), CaptureError>
Captures key to node immediately (implicit / declarative capture at down).
Sourcepub fn set_capture(
&mut self,
key: PointerKey,
node: NodeId,
) -> Result<(), CaptureError>
pub fn set_capture( &mut self, key: PointerKey, node: NodeId, ) -> Result<(), CaptureError>
W3C setPointerCapture: sets key’s pending capture target (node must be valid for
the caller, see CaptureError::InvalidTarget).
Sourcepub fn release_capture(
&mut self,
key: PointerKey,
node: NodeId,
) -> Result<(), CaptureError>
pub fn release_capture( &mut self, key: PointerKey, node: NodeId, ) -> Result<(), CaptureError>
W3C releasePointerCapture: clears key’s pending capture when node holds it (or any
node when node is NULL).
Sourcepub fn has_capture(&self, key: PointerKey, node: NodeId) -> bool
pub fn has_capture(&self, key: PointerKey, node: NodeId) -> bool
W3C hasPointerCapture: node is key’s pending capture target.
Sourcepub fn capture_of(&self, key: PointerKey) -> Option<NodeId>
pub fn capture_of(&self, key: PointerKey) -> Option<NodeId>
Current capture target of key.
Sourcepub fn process_pending_capture(&mut self, key: PointerKey) -> CaptureTransition
pub fn process_pending_capture(&mut self, key: PointerKey) -> CaptureTransition
Applies key’s pending capture; an app request (anything but the implicit target)
becomes a claim.
Sourcepub fn prune_captures(&mut self, drop: impl FnMut(NodeId) -> bool) -> bool
pub fn prune_captures(&mut self, drop: impl FnMut(NodeId) -> bool) -> bool
Drops capture (current and pending) on every slot where drop(node) holds; returns
whether anything changed.
Sourcepub fn keys(&self) -> ([PointerKey; 10], usize)
pub fn keys(&self) -> ([PointerKey; 10], usize)
Keys of every live slot (copied out so callers can mutate while iterating).