From db3dcaf447819d38d3bc6a3c3f9d074759efd9b2 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 30 Sep 2024 13:19:53 +0200 Subject: Remove debug-assert triggered by `with_layer_id/dnd_drag_source` (#5191) * Closes https://github.com/emilk/egui/issues/5178 --- crates/egui/src/ui.rs | 10 ++++++++++ crates/egui/src/widget_rect.rs | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index 76cca78e..04d48da3 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -2260,6 +2260,16 @@ impl Ui { } /// Redirect shapes to another paint layer. + /// + /// ``` + /// # use egui::{LayerId, Order, Id}; + /// # egui::__run_test_ui(|ui| { + /// let layer_id = LayerId::new(Order::Tooltip, Id::new("my_floating_ui")); + /// ui.with_layer_id(layer_id, |ui| { + /// ui.label("This is now in a different layer"); + /// }); + /// # }); + /// ``` pub fn with_layer_id( &mut self, layer_id: LayerId, diff --git a/crates/egui/src/widget_rect.rs b/crates/egui/src/widget_rect.rs index e69badb8..91924352 100644 --- a/crates/egui/src/widget_rect.rs +++ b/crates/egui/src/widget_rect.rs @@ -139,11 +139,6 @@ impl WidgetRects { // e.g. calling `response.interact(…)` to add more interaction. let (idx_in_layer, existing) = entry.get_mut(); - debug_assert!( - existing.layer_id == widget_rect.layer_id, - "Widget changed layer_id during the frame" - ); - // Update it: existing.rect = widget_rect.rect; // last wins existing.interact_rect = widget_rect.interact_rect; // last wins -- cgit v1.2.3-70-g09d2