From ba98ea715f16d05793242cc441606813a70e0690 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 8 Oct 2020 17:58:28 +0200 Subject: [PATCH] fix ui.expand_... functions to also expand max_rect --- egui/src/ui.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/egui/src/ui.rs b/egui/src/ui.rs index bfa46b9c5..5e846e8b3 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -290,12 +290,13 @@ impl Ui { /// Expand the bounding rect of this ui to include a child at the given rect. pub fn expand_to_include_child(&mut self, rect: Rect) { - self.min_rect.extend_with(rect.min); - self.min_rect.extend_with(rect.max); + self.min_rect = self.min_rect.union(rect); + self.max_rect = self.max_rect.union(rect); } pub fn expand_to_size(&mut self, size: Vec2) { self.min_rect.extend_with(self.left_top() + size); + self.max_rect.extend_with(self.left_top() + size); } // ------------------------------------------------------------------------