Implement textual hit testing

This commit is contained in:
Tom 2021-08-21 10:31:26 -07:00
parent 8333b8f88c
commit aa63841e2c
13 changed files with 341 additions and 75 deletions

View file

@ -1,8 +1,8 @@
use crate::{
button, checkbox, column, container, pane_grid, progress_bar, radio, row,
scrollable, slider, text, text_input, toggler, Color, Element, Font,
HorizontalAlignment, Layout, Padding, Point, Rectangle, Renderer, Size,
VerticalAlignment,
HitTestResult, HorizontalAlignment, Layout, Padding, Point, Rectangle,
Renderer, Size, Vector, VerticalAlignment,
};
/// A renderer that does nothing.
@ -67,6 +67,18 @@ impl text::Renderer for Null {
(0.0, 20.0)
}
fn hit_test(
&self,
_contents: &str,
_size: f32,
_font: Self::Font,
_bounds: Size,
_point: Point,
_nearest_only: bool,
) -> HitTestResult {
HitTestResult::NearestCharOffset(0, Vector::new(0., 0.))
}
fn draw(
&mut self,
_defaults: &Self::Defaults,