Add `TextWrapMode` in `Style ui` (#4994)
Add `TextWrapMode` in `Style ui` I think this would be useful for debugging.
This commit is contained in:
parent
0c528fb862
commit
fd0ce5fb65
|
|
@ -8,7 +8,7 @@ use epaint::{Rounding, Shadow, Stroke};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ecolor::*, emath::*, ComboBox, CursorIcon, FontFamily, FontId, Grid, Margin, Response,
|
ecolor::*, emath::*, ComboBox, CursorIcon, FontFamily, FontId, Grid, Margin, Response,
|
||||||
RichText, WidgetText,
|
RichText, TextWrapMode, WidgetText,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// How to format numbers in e.g. a [`crate::DragValue`].
|
/// How to format numbers in e.g. a [`crate::DragValue`].
|
||||||
|
|
@ -1501,7 +1501,7 @@ impl Style {
|
||||||
drag_value_text_style,
|
drag_value_text_style,
|
||||||
number_formatter: _, // can't change callbacks in the UI
|
number_formatter: _, // can't change callbacks in the UI
|
||||||
wrap: _,
|
wrap: _,
|
||||||
wrap_mode: _,
|
wrap_mode,
|
||||||
spacing,
|
spacing,
|
||||||
interaction,
|
interaction,
|
||||||
visuals,
|
visuals,
|
||||||
|
|
@ -1561,6 +1561,23 @@ impl Style {
|
||||||
});
|
});
|
||||||
ui.end_row();
|
ui.end_row();
|
||||||
|
|
||||||
|
ui.label("Text Wrap Mode");
|
||||||
|
crate::ComboBox::from_id_source("text_wrap_mode")
|
||||||
|
.selected_text(format!("{wrap_mode:?}"))
|
||||||
|
.show_ui(ui, |ui| {
|
||||||
|
let all_wrap_mode: Vec<Option<TextWrapMode>> = vec![
|
||||||
|
None,
|
||||||
|
Some(TextWrapMode::Extend),
|
||||||
|
Some(TextWrapMode::Wrap),
|
||||||
|
Some(TextWrapMode::Truncate),
|
||||||
|
];
|
||||||
|
for style in all_wrap_mode {
|
||||||
|
let text = crate::RichText::new(format!("{style:?}"));
|
||||||
|
ui.selectable_value(wrap_mode, style, text);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ui.end_row();
|
||||||
|
|
||||||
ui.label("Animation duration");
|
ui.label("Animation duration");
|
||||||
ui.add(
|
ui.add(
|
||||||
DragValue::new(animation_time)
|
DragValue::new(animation_time)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue