Skip to main content

TextSpanSpatial

Trait TextSpanSpatial 

Source
pub trait TextSpanSpatial {
    // Required methods
    fn intersects_rect(&self, rect: &Rect) -> bool;
    fn contained_in_rect(&self, rect: &Rect) -> bool;
    fn overlap_with_rect(&self, rect: &Rect) -> f32;
    fn matches_filter(&self, rect: &Rect, mode: RectFilterMode) -> bool;
}
Expand description

Extension trait for spatial filtering of text spans.

Required Methods§

Source

fn intersects_rect(&self, rect: &Rect) -> bool

Check if this span intersects with the given rectangle.

Source

fn contained_in_rect(&self, rect: &Rect) -> bool

Check if this span is fully contained within the given rectangle.

Source

fn overlap_with_rect(&self, rect: &Rect) -> f32

Calculate the overlap fraction (0.0-1.0) with the given rectangle.

Returns the ratio of the intersection area to this span’s area.

Source

fn matches_filter(&self, rect: &Rect, mode: RectFilterMode) -> bool

Check if this span matches the given filter mode for a rectangle.

Implementors§