Fix: respect existing text layout wrap settings in Label (#4704)
* Broke in github.com/emilk/egui/pull/4556 * Closes https://github.com/emilk/egui/issues/4701
This commit is contained in:
parent
5a6d68c5f6
commit
07735a6465
|
|
@ -182,8 +182,21 @@ impl Label {
|
||||||
}
|
}
|
||||||
(pos, galley, response)
|
(pos, galley, response)
|
||||||
} else {
|
} else {
|
||||||
layout_job.wrap =
|
// Apply wrap_mode, but don't overwrite anything important
|
||||||
text::TextWrapping::from_wrap_mode_and_width(wrap_mode, available_width);
|
// the user may have set manually on the layout_job:
|
||||||
|
match wrap_mode {
|
||||||
|
TextWrapMode::Extend => {
|
||||||
|
layout_job.wrap.max_width = f32::INFINITY;
|
||||||
|
}
|
||||||
|
TextWrapMode::Wrap => {
|
||||||
|
layout_job.wrap.max_width = available_width;
|
||||||
|
}
|
||||||
|
TextWrapMode::Truncate => {
|
||||||
|
layout_job.wrap.max_width = available_width;
|
||||||
|
layout_job.wrap.max_rows = 1;
|
||||||
|
layout_job.wrap.break_anywhere = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ui.is_grid() {
|
if ui.is_grid() {
|
||||||
// TODO(emilk): remove special Grid hacks like these
|
// TODO(emilk): remove special Grid hacks like these
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue