mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Move some PlacedRow methods back to Row
This commit is contained in:
@@ -693,6 +693,12 @@ impl Row {
|
||||
self.glyphs.len()
|
||||
}
|
||||
|
||||
/// Includes the implicit `\n` after the [`Row`], if any.
|
||||
#[inline]
|
||||
pub fn char_count_including_newline(&self) -> usize {
|
||||
self.glyphs.len() + (self.ends_with_newline as usize)
|
||||
}
|
||||
|
||||
/// Closest char at the desired x coordinate in row-relative coordinates.
|
||||
/// Returns something in the range `[0, char_count_excluding_newline()]`.
|
||||
pub fn char_at(&self, desired_x: f32) -> usize {
|
||||
@@ -711,15 +717,14 @@ impl Row {
|
||||
self.size.x
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn height(&self) -> f32 {
|
||||
self.size.y
|
||||
}
|
||||
}
|
||||
|
||||
impl PlacedRow {
|
||||
/// Includes the implicit `\n` after the [`Row`], if any.
|
||||
#[inline]
|
||||
pub fn char_count_including_newline(&self) -> usize {
|
||||
self.glyphs.len() + (self.ends_with_newline as usize)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn min_y(&self) -> f32 {
|
||||
self.rect().top()
|
||||
@@ -729,11 +734,6 @@ impl PlacedRow {
|
||||
pub fn max_y(&self) -> f32 {
|
||||
self.rect().bottom()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn height(&self) -> f32 {
|
||||
self.row.size.y
|
||||
}
|
||||
}
|
||||
|
||||
impl Galley {
|
||||
|
||||
Reference in New Issue
Block a user