pub struct HitGrid { /* private fields */ }Expand description
Hit testing grid for mouse interaction.
Maps screen positions to widget IDs, enabling widgets to receive mouse events for their regions.
Implementations§
Source§impl HitGrid
impl HitGrid
Sourcepub fn get_mut(&mut self, x: u16, y: u16) -> Option<&mut HitCell>
pub fn get_mut(&mut self, x: u16, y: u16) -> Option<&mut HitCell>
Get mutable reference to hit cell at (x, y).
Sourcepub fn register(
&mut self,
rect: Rect,
widget_id: HitId,
region: HitRegion,
data: HitData,
)
pub fn register( &mut self, rect: Rect, widget_id: HitId, region: HitRegion, data: HitData, )
Register a clickable region with the given hit metadata.
All cells within the rectangle will map to this hit cell.
Sourcepub fn hit_test(&self, x: u16, y: u16) -> Option<(HitId, HitRegion, HitData)>
pub fn hit_test(&self, x: u16, y: u16) -> Option<(HitId, HitRegion, HitData)>
Hit test at the given position.
Returns the hit tuple if a region is registered at (x, y).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HitGrid
impl RefUnwindSafe for HitGrid
impl Send for HitGrid
impl Sync for HitGrid
impl Unpin for HitGrid
impl UnsafeUnpin for HitGrid
impl UnwindSafe for HitGrid
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