fix: ellipsize

This commit is contained in:
Ashley Wulber 2026-02-19 22:54:08 -05:00
parent e8d53b14ea
commit e6fe1a6811

View file

@ -34,6 +34,7 @@ pub struct Toggler<'a, Message> {
spacing: f32,
font: Option<crate::font::Font>,
duration: Duration,
ellipsize: text::Ellipsize,
}
impl<'a, Message> Toggler<'a, Message> {
@ -63,6 +64,7 @@ impl<'a, Message> Toggler<'a, Message> {
spacing: 0.0,
font: None,
duration: Duration::from_millis(200),
ellipsize: text::Ellipsize::None,
}
}
@ -108,6 +110,12 @@ impl<'a, Message> Toggler<'a, Message> {
self
}
/// Sets the [`text::Ellipsize`] strategy of the [`Toggler`].
pub fn ellipsize(mut self, ellipsize: text::Ellipsize) -> Self {
self.ellipsize = ellipsize;
self
}
/// Sets the [`Font`] of the text of the [`Toggler`]
///
/// [`Font`]: cosmic::iced::text::Renderer::Font
@ -188,6 +196,7 @@ impl<'a, Message> Widget<Message, crate::Theme, crate::Renderer> for Toggler<'a,
align_y: alignment::Vertical::Top,
shaping: self.text_shaping,
wrapping: crate::iced_core::text::Wrapping::default(),
ellipsize: self.ellipsize,
},
);
match self.width {