summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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