[slider] remove ": " for sliders without text. still show value
This commit is contained in:
parent
f7122abc5d
commit
8f1def11f1
1 changed files with 9 additions and 8 deletions
|
@ -182,15 +182,16 @@ impl<'a> Slider<'a> {
|
|||
|
||||
/// Just the text label
|
||||
fn text_ui(&mut self, ui: &mut Ui, x_range: RangeInclusive<f32>) {
|
||||
let label_text = self.text.as_deref().unwrap_or_default();
|
||||
let label_text = format!("{}: ", label_text);
|
||||
let text_color = self.text_color.unwrap_or_else(|| ui.style().text_color);
|
||||
ui.style_mut().item_spacing.x = 0.0;
|
||||
ui.add(
|
||||
Label::new(label_text)
|
||||
.multiline(false)
|
||||
.text_color(text_color),
|
||||
);
|
||||
|
||||
if let Some(label_text) = self.text.as_deref() {
|
||||
ui.style_mut().item_spacing.x = 0.0;
|
||||
ui.add(
|
||||
Label::new(format!("{}: ", label_text))
|
||||
.multiline(false)
|
||||
.text_color(text_color),
|
||||
);
|
||||
}
|
||||
|
||||
let kb_edit_id = self.id.expect("We should have an id by now").with("edit");
|
||||
let is_kb_editing = ui.memory().has_kb_focus(kb_edit_id);
|
||||
|
|
Loading…
Reference in a new issue