ui: Ensure Label
with single_line
set does not wrap (#21444)
Release Notes: - N/A --- Split from #21438, this change for make sure the `single_line` mode Label will not be wrap. --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
41a973b13f
commit
afb253b406
3 changed files with 22 additions and 14 deletions
|
@ -56,20 +56,6 @@ impl Label {
|
|||
single_line: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Make the label display in a single line mode
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use ui::prelude::*;
|
||||
///
|
||||
/// let my_label = Label::new("Hello, World!").single_line();
|
||||
/// ```
|
||||
pub fn single_line(mut self) -> Self {
|
||||
self.single_line = true;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
// Style methods.
|
||||
|
@ -177,6 +163,12 @@ impl LabelCommon for Label {
|
|||
self.base = self.base.underline(underline);
|
||||
self
|
||||
}
|
||||
|
||||
fn single_line(mut self) -> Self {
|
||||
self.single_line = true;
|
||||
self.base = self.base.single_line();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for Label {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue