diff options
author | Emil Ernerfeldt <emil.ernerfeldt@gmail.com> | 2024-09-19 12:23:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-19 12:23:53 +0200 |
commit | e0f0b7f47f4094967530214aec060b9f1ce5954e (patch) | |
tree | af11f1614dc16a0a14ae4724a5e6af206fa1c6eb | |
parent | b1784249d28da4d99908ff3e7f7eaa4212be1e47 (diff) |
Remember to call `ui.register_rect` for better debug (#5130)
-rw-r--r-- | crates/egui/src/callstack.rs | 2 | ||||
-rw-r--r-- | crates/egui/src/ui.rs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/crates/egui/src/callstack.rs b/crates/egui/src/callstack.rs index 6b1959b0..03eeaf5f 100644 --- a/crates/egui/src/callstack.rs +++ b/crates/egui/src/callstack.rs @@ -94,7 +94,7 @@ pub fn capture() -> String { "<F as egui::widgets::Widget>", "egui_plot::", "egui_extras::", - "core::ptr::drop_in_place<egui::ui::Ui>::", + "core::ptr::drop_in_place<egui::ui::Ui>", "eframe::", "core::ops::function::FnOnce::call_once", "<alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once", diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index d56efbde..68debcb3 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -1240,7 +1240,6 @@ impl Ui { /// Ignore the layout of the [`Ui`]: just put my widget here! /// The layout cursor will advance to past this `rect`. pub fn allocate_rect(&mut self, rect: Rect, sense: Sense) -> Response { - register_rect(self, rect); let id = self.advance_cursor_after_rect(rect); self.interact(rect, id, sense) } @@ -1250,6 +1249,7 @@ impl Ui { debug_assert!(!rect.any_nan()); let item_spacing = self.spacing().item_spacing; self.placer.advance_after_rects(rect, rect, item_spacing); + register_rect(self, rect); let id = Id::new(self.next_auto_id_salt); self.next_auto_id_salt = self.next_auto_id_salt.wrapping_add(1); @@ -1363,6 +1363,7 @@ impl Ui { let rect = child_ui.min_rect(); let item_spacing = self.spacing().item_spacing; self.placer.advance_after_rects(rect, rect, item_spacing); + register_rect(self, rect); let response = self.interact(rect, child_ui.id, Sense::hover()); InnerResponse::new(inner, response) } @@ -2246,7 +2247,7 @@ impl Ui { self.next_auto_id_salt = next_auto_id_salt; // HACK: we want `scope` to only increment this once, so that `ui.scope` is equivalent to `ui.allocate_space`. let ret = add_contents(&mut child_ui); let response = child_ui.remember_min_rect(); - self.allocate_rect(child_ui.min_rect(), Sense::hover()); + self.advance_cursor_after_rect(child_ui.min_rect()); InnerResponse::new(ret, response) } |