summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Ernerfeldt <emil.ernerfeldt@gmail.com>2024-09-30 13:19:53 +0200
committerGitHub <noreply@github.com>2024-09-30 13:19:53 +0200
commitdb3dcaf447819d38d3bc6a3c3f9d074759efd9b2 (patch)
tree2568766b822a59c79b7b8224a77197990389345e
parent679f6f57b1ee5d8ed407dafbbd3c939d1ac8ce05 (diff)
Remove debug-assert triggered by `with_layer_id/dnd_drag_source` (#5191)
* Closes https://github.com/emilk/egui/issues/5178
-rw-r--r--crates/egui/src/ui.rs10
-rw-r--r--crates/egui/src/widget_rect.rs5
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<R>(
&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