pub struct HitMap<C: DragConfig = Config> { /* private fields */ }Expand description
Registry of selectable elements for one chart panel + point hit-testing.
Hosts feed pointer events here: hit_test returns the topmost registered
element under the point (later registrations win — register background
elements like the data area first, small foreground elements like titles
last). The model owns this because hit-testing is pure bounds geometry;
the renderer only supplies the MeasureText implementation.
Implementations§
Source§impl<C: DragConfig> HitMap<C>
impl<C: DragConfig> HitMap<C>
Sourcepub fn for_state() -> Self
pub fn for_state() -> Self
Create a map for an explicit state type; Cartesian callers keep new().
pub fn register( &mut self, el: impl Selectable<C> + Send + Sync + 'static, ) -> HitId
Sourcepub fn hit_test(
&self,
cfg: &C,
measure: &dyn MeasureText,
x: f32,
y: f32,
) -> Option<HitId>
pub fn hit_test( &self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32, ) -> Option<HitId>
Topmost element containing (x, y) — entries are tested in reverse
registration order.
pub fn get(&self, id: HitId) -> Option<&(dyn Selectable<C> + Send + Sync)>
Sourcepub fn selection_box(
&self,
id: HitId,
cfg: &C,
measure: &dyn MeasureText,
) -> Option<SelectionBox>
pub fn selection_box( &self, id: HitId, cfg: &C, measure: &dyn MeasureText, ) -> Option<SelectionBox>
Selection highlight for a registered element — the registered
element’s Selectable::selection_box policy.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Source§impl HitMap<Config>
impl HitMap<Config>
pub fn new() -> Self
Sourcepub fn standard_chart() -> Self
pub fn standard_chart() -> Self
The standard registration set for a single chart panel, back-to-front: data area → axes → tick-label bands → axis titles → legend → chart title → colourbar strip → colourbar axis → colourbar labels → colourbar title.
Colourbar chrome is last, so it wins over anything it overlaps. Its smaller parts follow the strip, allowing the ticks, labels, and title to be selected independently while the strip remains the resize target.