mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Small refactor of debug assert
This commit is contained in:
@@ -178,14 +178,6 @@ impl WidgetRects {
|
|||||||
// e.g. calling `response.interact(…)` to add more interaction.
|
// e.g. calling `response.interact(…)` to add more interaction.
|
||||||
let (idx_in_layer, existing) = entry.get_mut();
|
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:
|
// Update it:
|
||||||
existing.rect = widget_rect.rect; // last wins
|
existing.rect = widget_rect.rect; // last wins
|
||||||
existing.interact_rect = widget_rect.interact_rect; // last wins
|
existing.interact_rect = widget_rect.interact_rect; // last wins
|
||||||
@@ -200,6 +192,11 @@ impl WidgetRects {
|
|||||||
} else {
|
} else {
|
||||||
layer_widgets[*idx_in_layer] = *existing;
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user