From 1935fc0f1b45327b21e726fc44c758e414fd5939 Mon Sep 17 00:00:00 2001 From: Ted de Munnik Date: Sun, 29 Sep 2024 23:19:57 +0200 Subject: [PATCH] Fix issue where nested side panels can't be resized larger than their content layout rect, even if other size constraints are specified on the panel --- crates/egui/src/containers/panel.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/egui/src/containers/panel.rs b/crates/egui/src/containers/panel.rs index f3b6c913cfc..3b6dc54ecf9 100644 --- a/crates/egui/src/containers/panel.rs +++ b/crates/egui/src/containers/panel.rs @@ -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. @@ -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);