mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 06:41:14 +00:00
Move the text_input_byte_offset_for_position from the FontMetrics to the Window
In preparation of having mutiple-lines TextInput, we will need to give more data to this function so it no longer belong in FontMetrics Also remove the unused FontMetric::line_height()
This commit is contained in:
parent
e1be599bc0
commit
c1fc242a9a
7 changed files with 77 additions and 64 deletions
|
@ -66,6 +66,16 @@ pub trait PlatformWindow {
|
|||
reference_text: Pin<&crate::properties::Property<SharedString>>,
|
||||
) -> Box<dyn crate::graphics::FontMetrics>;
|
||||
|
||||
/// Returns the (UTF-8) byte offset in the text property that refers to the character that contributed to
|
||||
/// the glyph cluster that's visually nearest to the given coordinate. This is used for hit-testing,
|
||||
/// for example when receiving a mouse click into a text field. Then this function returns the "cursor"
|
||||
/// position.
|
||||
fn text_input_byte_offset_for_position(
|
||||
&self,
|
||||
text_input: Pin<&crate::items::TextInput>,
|
||||
pos: Point,
|
||||
) -> usize;
|
||||
|
||||
/// Return self as any so the backend can upcast
|
||||
fn as_any(&self) -> &dyn core::any::Any;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue