You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I often nest left-to-right and right-to-left layouts inside each other in order to place elements along the ends.
When a TextEdit is the last element in such a layout, it adds extra padding that isn't present when it neighbors another widget directly:
I've set the item_spacing to 0 to make the effect more clear.
In the top layout, the button on the right is placed first, using a right-to-left layout to make it the rightmost element. Then a left-to-right layout takes up the remaining space, and the label and textbox are placed inside it. This makes the textbox the last element within that nested layout, and there's thus a space between it and the button.
In the one below it, the label, textbox, and button are all part of the same left-to-right layout. This results in there being no extra spacing between them, as intended.
This nesting of layouts seems to be the only way to robustly handle resizing, so it's important for my use case:
To Reproduce
Demo snippet
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {let _ = ui.button("Button");
ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
ui.label("Label");letmut buf = String::from("This is some text");let _ = ui.text_edit_singleline(&mut buf);});});
ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
ui.label("Label");letmut buf = String::from("This is some text");let _ = ui.text_edit_singleline(&mut buf);let _ = ui.button("Button");});
Expected behavior
Both layouts should have the same spacing.
Screenshots
See above
Additional context
I've traced this problem back to this commit, which subtracts off a margin from the TextEdit's size.
The text was updated successfully, but these errors were encountered:
Describe the bug
I often nest left-to-right and right-to-left layouts inside each other in order to place elements along the ends.
When a
TextEdit
is the last element in such a layout, it adds extra padding that isn't present when it neighbors another widget directly:I've set the
item_spacing
to 0 to make the effect more clear.In the top layout, the button on the right is placed first, using a right-to-left layout to make it the rightmost element. Then a left-to-right layout takes up the remaining space, and the label and textbox are placed inside it. This makes the textbox the last element within that nested layout, and there's thus a space between it and the button.
In the one below it, the label, textbox, and button are all part of the same left-to-right layout. This results in there being no extra spacing between them, as intended.
This nesting of layouts seems to be the only way to robustly handle resizing, so it's important for my use case:
To Reproduce
Demo snippet
Expected behavior
Both layouts should have the same spacing.
Screenshots
See above
Additional context
I've traced this problem back to this commit, which subtracts off a margin from the
TextEdit
's size.The text was updated successfully, but these errors were encountered: