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