1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Small refactor of debug assert

This commit is contained in:
Emil Ernerfeldt
2025-12-22 20:39:49 +01:00
parent ec4313d8a8
commit f53a9c96d5

View File

@@ -178,14 +178,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 from {:?} to {:?}",
widget_rect.id,
existing.layer_id,
widget_rect.layer_id
);
// Update it:
existing.rect = widget_rect.rect; // last wins
existing.interact_rect = widget_rect.interact_rect; // last wins
@@ -200,6 +192,11 @@ impl WidgetRects {
} else {
layer_widgets[*idx_in_layer] = *existing;
}
} else if cfg!(debug_assertions) {
panic!(
"DEBUG ASSERT: Widget {:?} changed layer_id during the frame from {:?} to {:?}",
widget_rect.id, existing.layer_id, widget_rect.layer_id
);
}
}
}