Skip to main content

HoverManager

Struct HoverManager 

Source
pub struct HoverManager { /* private fields */ }
Expand description

Manages hover state history for all input points

Records hit test results for mouse and touch inputs over multiple frames:

  • DragStart detection (requires movement threshold over multiple frames)
  • Hover-over event detection
  • Multi-touch gesture detection
  • Input path analysis

The manager maintains a separate history for each active input point.

Implementations§

Source§

impl HoverManager

Source

pub const fn new() -> Self

Create a new empty HoverManager

Source

pub fn debug_counts(&self) -> (usize, usize)

(input points, total history entries across all points). Used by AZ_E2E_TEST to watch for unbounded growth.

Source

pub fn push_hit_test(&mut self, input_id: InputPointId, hit_test: FullHitTest)

Push a new hit test result for a specific input point

The most recent result is always at index 0 for that input point. If the history is full, the oldest frame is dropped.

Source

pub fn remove_input_point(&mut self, input_id: &InputPointId)

Remove an input point’s history (e.g., when touch ends)

Source

pub fn get_current(&self, input_id: &InputPointId) -> Option<&FullHitTest>

Get the most recent hit test result for an input point

Returns None if no hit tests have been recorded for this input point.

Source

pub fn get_current_mouse(&self) -> Option<&FullHitTest>

Get the most recent mouse cursor hit test (convenience method)

Source

pub fn get_frame( &self, input_id: &InputPointId, frames_ago: usize, ) -> Option<&FullHitTest>

Get the hit test result from N frames ago for an input point (0 = current frame)

Returns None if the requested frame is not in history.

Source

pub fn get_history( &self, input_id: &InputPointId, ) -> Option<&VecDeque<FullHitTest>>

Get the entire hover history for an input point (most recent first)

Source

pub fn get_active_input_points(&self) -> Vec<InputPointId>

Get all currently tracked input points

Source

pub fn frame_count(&self, input_id: &InputPointId) -> usize

Get the number of frames in history for an input point

Source

pub fn purge_dom(&mut self, dom_id: &DomId)

Purge every recorded hit-test entry for dom_id across all input points and all history frames.

Called when a VirtualView child DOM is rebuilt IN PLACE (fresh NodeIds, no reconcile mapping — e.g. a MapWidget pan rebuilding the tile grid): the recorded hits for that DOM reference the OLD generation’s NodeIds, and consumers that resolve them against the NEW styled DOM read out of bounds (the hit_test.rs cursor panic: “len is 25 but the index is 27”) or target the wrong node. Unlike incremental reconciles there is no NodeId map to remap with, so the only safe option is to forget that DOM’s hits; the next pointer move re-populates them from a fresh hit test.

Source

pub fn clear(&mut self)

Clear all hover history for all input points

Source

pub fn has_sufficient_history_for_gestures( &self, input_id: &InputPointId, ) -> bool

Check if we have enough frames for gesture detection on an input point

DragStart detection requires analyzing movement over multiple frames. This returns true if we have at least 2 frames of history.

Source

pub fn any_has_sufficient_history_for_gestures(&self) -> bool

Check if any input point has enough history for gesture detection

Source

pub fn current_hover_node(&self) -> Option<NodeId>

Get the deepest hovered node from the current mouse hit test.

Returns the NodeId of the most specific (deepest in DOM tree) node that the mouse cursor is currently over, or None if not hovering anything.

NOTE: Assumes single-DOM architecture (uses DomId { inner: 0 }).

Source

pub fn previous_hover_node(&self) -> Option<NodeId>

Get the deepest hovered node from the previous frame’s mouse hit test.

Returns the NodeId from one frame ago, or None if not hovering anything or no previous frame exists.

NOTE: Assumes single-DOM architecture (uses DomId { inner: 0 }).

Source

pub fn current_hover_node_full(&self) -> Option<DomNodeId>

Multi-DOM aware: the deepest hovered node across ALL hit DOMs (current frame). Returns a full DomNodeId so events can target VirtualView / iframe child DOMs, not just the root.

Selection rule: prefer the most-nested DOM that was hit. Child DOMs (VirtualView / iframe content) always have higher DomIds than their host and are composited on top of it, so the highest hit DomId is the front-most surface. Within that DOM the deepest node (last in NodeId order) is the W3C event target; bubbling then reaches ancestor handlers.

For single-DOM apps only DomId 0 is ever hit, so this is equivalent to [current_hover_node] wrapped in DomId { inner: 0 }.

Source

pub fn previous_hover_node_full(&self) -> Option<DomNodeId>

Multi-DOM aware counterpart of [previous_hover_node] (one frame ago).

Trait Implementations§

Source§

impl Clone for HoverManager

Source§

fn clone(&self) -> HoverManager

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HoverManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HoverManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for HoverManager

Source§

impl NodeIdRemap for HoverManager

Source§

fn remap_node_ids(&mut self, dom_id: DomId, map: &NodeIdMap)

Remap NodeIds in all hover histories after DOM reconciliation.

Hits on unmounted nodes are dropped (they cannot be hovered any more) — keeping them would make the hover history describe a node that no longer exists at that index.

Source§

impl PartialEq for HoverManager

Source§

fn eq(&self, other: &HoverManager) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HoverManager

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.