From 98bb0f4110d15afc0cccb2fabd2effcd1c3091f2 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 8 Dec 2020 21:32:12 +0100 Subject: [PATCH] Fix combo box width --- TODO.md | 5 ++--- egui/src/layout.rs | 1 - egui/src/ui.rs | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index d4868cd9..88b824d0 100644 --- a/TODO.md +++ b/TODO.md @@ -4,9 +4,8 @@ TODO-list for the Egui project. If you looking for something to do, look here. ## Layout refactor -* Deprecate `add_custom_contents` -* Fix and test `allocate_ui` -* +* Test `allocate_ui` +* Justified alignment of radio button and checkboxes ## Misc diff --git a/egui/src/layout.rs b/egui/src/layout.rs index fbe60770..11dc62e1 100644 --- a/egui/src/layout.rs +++ b/egui/src/layout.rs @@ -465,7 +465,6 @@ impl Layout { Direction::TopDown => pos2(rect.left(), rect.bottom() + item_spacing.y), Direction::BottomUp => pos2(rect.left(), rect.top() - item_spacing.y), }; - region.expand_to_include_rect(rect); } } diff --git a/egui/src/ui.rs b/egui/src/ui.rs index aea8c08c..231529d7 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -454,6 +454,7 @@ impl Ui { self.layout .advance_after_outer_rect(&mut self.region, outer_child_rect, item_spacing); + self.region.expand_to_include_rect(inner_child_rect); self.next_auto_id = self.next_auto_id.wrapping_add(1); inner_child_rect @@ -483,6 +484,7 @@ impl Ui { outer_child_rect.union(final_child_rect), item_spacing, ); + self.region.expand_to_include_rect(final_child_rect); let response = self.interact_hover(final_child_rect); (ret, response) @@ -512,6 +514,7 @@ impl Ui { outer_child_rect.union(final_child_rect), item_spacing, ); + self.region.expand_to_include_rect(final_child_rect); let response = self.interact_hover(final_child_rect); (ret, response) @@ -852,6 +855,7 @@ impl Ui { let item_spacing = self.style().spacing.item_spacing; self.layout .advance_after_outer_rect(&mut self.region, rect, item_spacing); + self.region.expand_to_include_rect(rect); (ret, self.interact_hover(rect)) }