diff options
author | 2021-08-26 14:53:15 +0700 | |
---|---|---|
committer | 2021-08-26 14:53:15 +0700 | |
commit | 6821114cae2e41fd2bc69d6fcaee1e8574ac061d (patch) | |
tree | 5741859eba63251190eb0a901a72ef4e185349e7 /glow/src/backend.rs | |
parent | 2d65621a3b680457e689b93c800e74f726ffc175 (diff) | |
parent | 7614127d3641cf3224798c2f0ff07b6ae57d9a53 (diff) | |
download | iced-6821114cae2e41fd2bc69d6fcaee1e8574ac061d.tar.gz iced-6821114cae2e41fd2bc69d6fcaee1e8574ac061d.tar.bz2 iced-6821114cae2e41fd2bc69d6fcaee1e8574ac061d.zip |
Merge pull request #670 from twitchyliquid64/text_backend
Refactor textual hit testing into a `renderer::Backend` method
Diffstat (limited to 'glow/src/backend.rs')
-rw-r--r-- | glow/src/backend.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/glow/src/backend.rs b/glow/src/backend.rs index 1680fc00..37c0ac9d 100644 --- a/glow/src/backend.rs +++ b/glow/src/backend.rs @@ -2,6 +2,7 @@ use crate::quad; use crate::text; use crate::triangle; use crate::{Settings, Transformation, Viewport}; + use iced_graphics::backend; use iced_graphics::font; use iced_graphics::Layer; @@ -211,6 +212,25 @@ impl backend::Text for Backend { ) -> (f32, f32) { self.text_pipeline.measure(contents, size, font, bounds) } + + fn hit_test( + &self, + contents: &str, + size: f32, + font: Font, + bounds: Size, + point: iced_native::Point, + nearest_only: bool, + ) -> text::Hit { + self.text_pipeline.hit_test( + contents, + size, + font, + bounds, + point, + nearest_only, + ) + } } #[cfg(feature = "image")] |