diff options
Diffstat (limited to 'native/src/widget/text.rs')
-rw-r--r-- | native/src/widget/text.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index 6cc18e6c..adf6a74f 100644 --- a/native/src/widget/text.rs +++ b/native/src/widget/text.rs @@ -4,6 +4,8 @@ use crate::{ Rectangle, Size, VerticalAlignment, Widget, }; +pub use iced_core::text::Hit; + use std::hash::Hash; /// A paragraph of text. @@ -179,6 +181,23 @@ pub trait Renderer: crate::Renderer { bounds: Size, ) -> (f32, f32); + /// Tests whether the provided point is within the boundaries of [`Text`] + /// laid out with the given parameters, returning information about + /// the nearest character. + /// + /// If `nearest_only` is true, the hit test does not consider whether the + /// the point is interior to any glyph bounds, returning only the character + /// with the nearest centeroid. + fn hit_test( + &self, + contents: &str, + size: f32, + font: Self::Font, + bounds: Size, + point: Point, + nearest_only: bool, + ) -> Hit; + /// Draws a [`Text`] fragment. /// /// It receives: |