pub struct SpatialIndex { /* private fields */ }Expand description
Accelerated spatial index maintaining entity bounding boxes and event listeners.
Implementations§
Source§impl SpatialIndex
impl SpatialIndex
Sourcepub fn sync_bounds(&mut self, layout_root: &LayoutNode)
pub fn sync_bounds(&mut self, layout_root: &LayoutNode)
Synchronizes cached entry bounding boxes from layout_root in O(entries) without
walking blueprints or reallocating the index (used on high-frequency scroll ticks).
Sourcepub fn rebuild(&mut self, blueprint: &NodeBlueprint, layout: &LayoutNode)
pub fn rebuild(&mut self, blueprint: &NodeBlueprint, layout: &LayoutNode)
Clears and rebuilds the spatial index from the active blueprint and computed layout hierarchy.
Sourcepub fn query_entity_at_point(&self, px: f32, py: f32) -> Option<EntityId>
pub fn query_entity_at_point(&self, px: f32, py: f32) -> Option<EntityId>
Queries the front-most / deepest EntityId at point (px, py), honoring stacking z_index and paint order.
Sourcepub fn query_event_at_point(
&self,
px: f32,
py: f32,
event_type: EventType,
) -> Option<(EntityId, Rc<dyn Fn(Event)>, Rect)>
pub fn query_event_at_point( &self, px: f32, py: f32, event_type: EventType, ) -> Option<(EntityId, Rc<dyn Fn(Event)>, Rect)>
Queries the front-most event listener registered for event_type at point (px, py),
honoring stacking z_index and paint order.
Sourcepub fn get_bounds(&self, entity_id: EntityId) -> Option<Rect>
pub fn get_bounds(&self, entity_id: EntityId) -> Option<Rect>
Returns the bounding box of an entity if present in the index.
Trait Implementations§
Source§impl Clone for SpatialIndex
impl Clone for SpatialIndex
Source§impl Debug for SpatialIndex
impl Debug for SpatialIndex
Auto Trait Implementations§
impl !RefUnwindSafe for SpatialIndex
impl !Send for SpatialIndex
impl !Sync for SpatialIndex
impl !UnwindSafe for SpatialIndex
impl Forget for SpatialIndex
impl Freeze for SpatialIndex
impl Move for SpatialIndex
impl Unpin for SpatialIndex
impl UnsafeUnpin for SpatialIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more