Skip to content

Commit

Permalink
Fix issue where nested side panels can't be resized larger than their…
Browse files Browse the repository at this point in the history
… content layout rect, even if other size constraints are specified on the panel
  • Loading branch information
teddemunnik committed Sep 29, 2024
1 parent 59d7183 commit 1935fc0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,19 @@ impl SidePanel {
add_contents(ui)
});

let rect = inner_response.response.rect;

{
let mut cursor = ui.cursor();
match side {
Side::Left => {
cursor.min.x = rect.max.x;
cursor.min.x = panel_rect.max.x;
}
Side::Right => {
cursor.max.x = rect.min.x;
cursor.max.x = panel_rect.min.x;
}
}
ui.set_cursor(cursor);
}
ui.expand_to_include_rect(rect);
ui.expand_to_include_rect(panel_rect);

if resizable {
// Now we do the actual resize interaction, on top of all the contents.
Expand Down Expand Up @@ -330,7 +328,7 @@ impl SidePanel {
}

// Keep this rect snapped so that panel content can be pixel-perfect
let rect = ui.painter().round_rect_to_pixels(rect);
let rect = ui.painter().round_rect_to_pixels(panel_rect);

PanelState { rect }.store(ui.ctx(), id);

Expand Down

0 comments on commit 1935fc0

Please sign in to comment.