pub struct LineLayout {
pub char_range: (usize, usize),
pub y: f32,
pub height: f32,
pub boundary_chars: Vec<usize>,
pub boundary_x: Vec<f32>,
}Expand description
One line’s geometry within a TextLayoutSnapshot. TextInput
(single-line) always has exactly one; TextArea (Step 4) will have
one per wrapped visual line — the shape already supports that, so
Step 4 needs no snapshot redesign.
Fields§
§char_range: (usize, usize)Char range [start, end) this line’s text spans (end exclusive
of any line-break character).
y: f32Top y and height, WORLD-SPACE (matching EditableDecl::rect) —
so engine dispatch can query directly against raw click
coordinates with no translation.
height: f32§boundary_chars: Vec<usize>Absolute char index of every grapheme boundary in this line,
ascending, paired 1:1 with boundary_x.
boundary_x: Vec<f32>World-space x of each boundary in boundary_chars.
Implementations§
Source§impl LineLayout
impl LineLayout
Sourcepub fn x_at(&self, target: usize) -> f32
pub fn x_at(&self, target: usize) -> f32
World-space x of target within this line — clamped to the
line’s own char_range first, so an index from a multi-line
selection or a Span that extends past this line’s end/start
still resolves to a sane on-screen position (this line’s own
right/left edge) instead of panicking or guessing.
Trait Implementations§
Source§impl Clone for LineLayout
impl Clone for LineLayout
Source§fn clone(&self) -> LineLayout
fn clone(&self) -> LineLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more