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 fn new() -> Self

Create a new empty HoverManager

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

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 clear(&mut self)

Clear all hover history for all input points

Source

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

Clear history for a specific input point

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.

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.

Source

pub fn remap_node_ids( &mut self, dom_id: DomId, node_id_map: &BTreeMap<NodeId, NodeId>, )

Remap NodeIds in all hover histories after DOM reconciliation.

When the DOM is regenerated, NodeIds can change. This method updates all stored NodeIds in hover histories using the old→new mapping from reconciliation. Nodes not found in the map are removed from hit tests.

Trait Implementations§

Source§

impl Clone for HoverManager

Source§

fn clone(&self) -> HoverManager

Returns a duplicate of the value. Read more
1.0.0 · 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 PartialEq for HoverManager

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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<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.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool