vertical ui in horizontal_wrapped ui fails to wrap
Describe the bug
Put this code in the eframe template:
ui.horizontal_wrapped(|ui| {
for i in 0..10 {
ui.vertical(|ui| {
ui.label(format!("{}", i));
ui.label("foo");
ui.label(format!("{} more", i));
});
}
});
Expected behavior
It should wrap something like this:
I constructed this image in an image editor, as I am unable to achieve this functionality in egui.
Desktop:
- OS: arch linux
- Browser: firefox and desktop
Occurs on egui 0.22 but I think I also remember this happening last time I played with egui a year or so ago.
I noticed that a lot of things don't wrap properly inside of a horizontal_wrapped (I tested, group, vertical and horizontal) but if you add them through a add_sized then it works properly.
It feels like a workaround but yeah...
Wrapping for Frame inside horizontal_wrapped doesn't work too.
ui.horizontal_wrapped(|ui| {
for tag in article.tags.iter() {
Frame::NONE
.corner_radius(15.)
.fill(Color32::LIGHT_RED)
.inner_margin(Margin::symmetric(10, 5))
.show(ui, |ui| {
Label::new(RichText::new(tag).color(Color32::WHITE).size(16.)).selectable(false).ui(ui);
});
}
});
But if I use only Label it works:
ui.horizontal_wrapped(|ui| {
for tag in article.tags.iter() {
Label::new(RichText::new(tag).color(Color32::WHITE).size(16.)).selectable(false).ui(ui);
}
});