Skip to main content

ferroui_base/rendering/
i_custom_hit_test.rs

1use crate::media::{Geometry, IntersectionResult};
2use crate::{Point, Ref};
3
4/// An interface to allow non-templated controls to customize their hit
5/// testing when using a renderer with a simple hit-testing algorithm, where
6/// just the bounds or geometries are hit-tested.
7pub trait ICustomHitTest {
8    /// Whether the control is hit at the specified point, in coordinates
9    /// relative to the control.
10    fn hit_test(&self, point: Point) -> bool;
11
12    /// The intersection of the control with a geometry.
13    fn hit_test_geometry(&self, _geometry: &Ref<Geometry>) -> IntersectionResult {
14        IntersectionResult::Empty
15    }
16}