From 2fa03f9a6c5829af26d181087668586b33803179 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 3 Jun 2020 10:59:31 +0200 Subject: [PATCH] [window] improve automatic window positions --- egui/src/containers/area.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/egui/src/containers/area.rs b/egui/src/containers/area.rs index 1962ab11..64f05dbe 100644 --- a/egui/src/containers/area.rs +++ b/egui/src/containers/area.rs @@ -265,6 +265,18 @@ fn automatic_area_position(ctx: &Context) -> Pos2 { } } + { + // Look for large spaces between columns (empty columns): + let mut x = left; + for col_bb in &column_bbs { + let available = col_bb.left() - x; + if available >= 300.0 { + return pos2(x, top); + } + x = col_bb.right() + spacing; + } + } + // Find first column with some available space at the bottom of it: for col_bb in &column_bbs { if col_bb.bottom() < ctx.input().screen_size.y * 0.5 {