From 6add64e144401602be86e6df8cab90133173e1b3 Mon Sep 17 00:00:00 2001 From: zhatuokun <62168376+zhatuokun@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:54:27 +0800 Subject: [PATCH] Fix: `Sides` did not apply the layout position correctly. (#5232) Run this code ```rs CentralPanel::default().show(ctx, |ui| { Sides::new().show( ui, |ui| { ui.label("1"); }, |ui| { ui.label("2"); }, ); Sides::new().show( ui, |ui| { ui.label("11"); }, |ui| { ui.label("22"); }, ); Sides::new().show( ui, |ui| { ui.label("111"); }, |ui| { ui.label("222"); }, ); }); ``` Before ![before](https://github.com/user-attachments/assets/2678f937-859e-422a-9171-5f2a63166c8f) After ![after](https://github.com/user-attachments/assets/879892f1-a69d-4540-8e56-8b2448e939ed) --- crates/egui/src/containers/sides.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/containers/sides.rs b/crates/egui/src/containers/sides.rs index 3bc353380d0..18b508275d0 100644 --- a/crates/egui/src/containers/sides.rs +++ b/crates/egui/src/containers/sides.rs @@ -78,7 +78,7 @@ impl Sides { let height = height.unwrap_or_else(|| ui.spacing().interact_size.y); let spacing = spacing.unwrap_or_else(|| ui.spacing().item_spacing.x); - let mut top_rect = ui.max_rect(); + let mut top_rect = ui.cursor(); top_rect.max.y = top_rect.min.y + height; let result_left;