Skip to main content

IHitTester

Trait IHitTester 

Source
pub trait IHitTester {
    // Required methods
    fn hit_test(
        &self,
        p: Point,
        root: &Visual,
        filter: Option<&dyn Fn(&Visual) -> bool>,
    ) -> Vec<Ref<Visual>>;
    fn hit_test_geometry(
        &self,
        geometry: &Geometry,
        root: &Visual,
        filter: Option<&dyn Fn(&Visual) -> bool>,
    ) -> Vec<GeometryHitTestResult>;
    fn hit_test_first(
        &self,
        p: Point,
        root: &Visual,
        filter: Option<&dyn Fn(&Visual) -> bool>,
    ) -> Option<Ref<Visual>>;
    fn hit_test_first_geometry(
        &self,
        geometry: &Geometry,
        root: &Visual,
        filter: Option<&dyn Fn(&Visual) -> bool>,
    ) -> Option<GeometryHitTestResult>;
}
Expand description

An interface to allow hit testing of a visual tree.

Hit testing through this interface is low-level and does not respect input hit test visibility. Use the input hit testing methods of InputElement to perform input hit testing, or provide your own filter.

Required Methods§

Source

fn hit_test( &self, p: Point, root: &Visual, filter: Option<&dyn Fn(&Visual) -> bool>, ) -> Vec<Ref<Visual>>

Hit tests a location to find the visuals at the specified point, topmost first.

p is the point in coordinates relative to root, the root of the subtree to search. If filter returns false for a visual then the visual and all its descendants are excluded from the results.

Source

fn hit_test_geometry( &self, geometry: &Geometry, root: &Visual, filter: Option<&dyn Fn(&Visual) -> bool>, ) -> Vec<GeometryHitTestResult>

Hit tests a geometry to find the visuals intersecting a region, topmost first.

geometry is in coordinates relative to root, the root of the subtree to search. If filter returns false for a visual then the visual and all its descendants are excluded from the results.

Source

fn hit_test_first( &self, p: Point, root: &Visual, filter: Option<&dyn Fn(&Visual) -> bool>, ) -> Option<Ref<Visual>>

Hit tests a location to find the first (topmost) visual at the specified point.

See hit_test for the parameters.

Source

fn hit_test_first_geometry( &self, geometry: &Geometry, root: &Visual, filter: Option<&dyn Fn(&Visual) -> bool>, ) -> Option<GeometryHitTestResult>

Hit tests a geometry to find the first (topmost) visual intersecting a region.

See hit_test_geometry for the parameters.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§