summaryrefslogtreecommitdiffstats
path: root/graphics/src/backend.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/backend.rs')
-rw-r--r--graphics/src/backend.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/graphics/src/backend.rs b/graphics/src/backend.rs
index ed1b9e08..94124509 100644
--- a/graphics/src/backend.rs
+++ b/graphics/src/backend.rs
@@ -1,7 +1,7 @@
//! Write a graphics backend.
use iced_native::image;
use iced_native::svg;
-use iced_native::{Font, Size};
+use iced_native::{Font, HitTestResult, Point, Size};
/// The graphics backend of a [`Renderer`].
///
@@ -43,6 +43,23 @@ pub trait Text {
font: Font,
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: Font,
+ bounds: Size,
+ point: Point,
+ nearest_only: bool,
+ ) -> HitTestResult;
}
/// A graphics backend that supports image rendering.