feat: add Ellipsize to widgets
This commit is contained in:
parent
f2ef716ad5
commit
cc670e1966
18 changed files with 181 additions and 9 deletions
|
|
@ -32,7 +32,7 @@ use crate::{
|
|||
};
|
||||
|
||||
use std::borrow::Cow;
|
||||
pub use text::{Alignment, LineHeight, Shaping, Wrapping};
|
||||
pub use text::{Alignment, Ellipsize, LineHeight, Shaping, Wrapping};
|
||||
|
||||
/// A bunch of text.
|
||||
///
|
||||
|
|
@ -158,6 +158,12 @@ where
|
|||
self
|
||||
}
|
||||
|
||||
// Sets the [`Ellipsize`] strategy of the [`Text`].
|
||||
pub fn ellipsize(mut self, ellipsize: Ellipsize) -> Self {
|
||||
self.format.ellipsize = ellipsize;
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the style of the [`Text`].
|
||||
#[must_use]
|
||||
pub fn style(mut self, style: impl Fn(&Theme) -> Style + 'a) -> Self
|
||||
|
|
@ -328,6 +334,7 @@ pub struct Format<Font> {
|
|||
pub align_y: alignment::Vertical,
|
||||
pub shaping: Shaping,
|
||||
pub wrapping: Wrapping,
|
||||
pub ellipsize: Ellipsize,
|
||||
}
|
||||
|
||||
impl<Font> Default for Format<Font> {
|
||||
|
|
@ -342,6 +349,7 @@ impl<Font> Default for Format<Font> {
|
|||
align_y: alignment::Vertical::Top,
|
||||
shaping: Shaping::default(),
|
||||
wrapping: Wrapping::default(),
|
||||
ellipsize: Ellipsize::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -373,6 +381,7 @@ where
|
|||
align_y: format.align_y,
|
||||
shaping: format.shaping,
|
||||
wrapping: format.wrapping,
|
||||
ellipsize: format.ellipsize,
|
||||
});
|
||||
|
||||
paragraph.min_bounds()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue