Skip to content

Commit

Permalink
Grid: set the sizing_pass flag during the initial sizing pass (em…
Browse files Browse the repository at this point in the history
…ilk#4612)

* Part of emilk#4535

This should improve the auto-sizing of columns when nesting expanding
widgets (e.g. `Separator`), or centered or justified layouts.
  • Loading branch information
emilk authored and hacknus committed Oct 30, 2024
1 parent 2806b9d commit b4d6a7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/egui/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b4d6a7c

Please sign in to comment.