ferroui_base/rendering/composition/hit_testing/
i_composition_hit_tester.rs1use crate::media::IntersectionResult;
2use crate::platform::{IGeometryImpl, LtrbRect};
3use crate::rendering::composition::CompositionVisual;
4use crate::Matrix;
5
6pub trait ICompositionHitTester {
9 type Input: Clone;
10
11 fn transform(input: &Self::Input, matrix: Matrix) -> Self::Input;
12
13 fn hit_test(visual: &CompositionVisual, input: &Self::Input) -> IntersectionResult;
14
15 fn transformed_sub_tree_bounds_match(bounds: LtrbRect, input: &Self::Input) -> bool;
16
17 fn clipped_bounds_match(visual: &CompositionVisual, input: &Self::Input) -> bool;
18
19 fn clip_matches(clip: &dyn IGeometryImpl, input: &Self::Input) -> bool;
20}
21
22pub fn is_hit(result: IntersectionResult) -> bool {
24 (result as i32) > (IntersectionResult::Empty as i32)
25}