Implement textual hit testing
This commit is contained in:
parent
8333b8f88c
commit
aa63841e2c
13 changed files with 341 additions and 75 deletions
|
|
@ -7,7 +7,9 @@ use iced_graphics::font;
|
|||
use iced_graphics::layer::Layer;
|
||||
use iced_graphics::{Primitive, Viewport};
|
||||
use iced_native::mouse;
|
||||
use iced_native::{Font, HorizontalAlignment, Size, VerticalAlignment};
|
||||
use iced_native::{
|
||||
Font, HitTestResult, HorizontalAlignment, Size, VerticalAlignment,
|
||||
};
|
||||
|
||||
#[cfg(any(feature = "image_rs", feature = "svg"))]
|
||||
use crate::image;
|
||||
|
|
@ -274,6 +276,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,
|
||||
) -> HitTestResult {
|
||||
self.text_pipeline.hit_test(
|
||||
contents,
|
||||
size,
|
||||
font,
|
||||
bounds,
|
||||
point,
|
||||
nearest_only,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "image_rs")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue