1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Grid: set the sizing_pass flag during the initial sizing pass (#4612)

* Part of https://github.com/emilk/egui/issues/4535

This should improve the auto-sizing of columns when nesting expanding
widgets (e.g. `Separator`), or centered or justified layouts.
This commit is contained in:
Emil Ernerfeldt
2024-06-05 12:17:08 +02:00
committed by GitHub
parent a28792194d
commit a50f253b76

View File

@@ -426,7 +426,10 @@ impl Grid {
// which we do here:
let max_rect = ui.cursor().intersect(ui.max_rect());
ui.allocate_ui_at_rect(max_rect, |ui| {
ui.set_visible(prev_state.is_some()); // Avoid visible first-frame jitter
if prev_state.is_none() {
// Hide the ui this frame, and make things as narrow as possible.
ui.set_sizing_pass();
}
ui.horizontal(|ui| {
let is_color = color_picker.is_some();
let mut grid = GridLayout {