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§
Sourcefn intersects_rect(&self, rect: &Rect) -> bool
fn intersects_rect(&self, rect: &Rect) -> bool
Check if this span intersects with the given rectangle.
Sourcefn contained_in_rect(&self, rect: &Rect) -> bool
fn contained_in_rect(&self, rect: &Rect) -> bool
Check if this span is fully contained within the given rectangle.
Sourcefn overlap_with_rect(&self, rect: &Rect) -> f32
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.
Sourcefn matches_filter(&self, rect: &Rect, mode: RectFilterMode) -> bool
fn matches_filter(&self, rect: &Rect, mode: RectFilterMode) -> bool
Check if this span matches the given filter mode for a rectangle.