fix duplicate id in tree viewer

This commit is contained in:
Rusty Striker 2022-07-30 17:50:52 +03:00
parent 7a3d51a626
commit db8657bb96

View file

@ -71,7 +71,7 @@ pub fn action_bar_sys(
pub fn shape_tree_sys( pub fn shape_tree_sys(
mut egui_ctx: ResMut<EguiContext>, mut egui_ctx: ResMut<EguiContext>,
shapes: Query<&ShapeData>, shapes: Query<(Entity, &ShapeData)>,
mut transforms: Query<&mut Transform>, mut transforms: Query<&mut Transform>,
) { ) {
if !shapes.is_empty() { if !shapes.is_empty() {
@ -80,7 +80,9 @@ pub fn shape_tree_sys(
.title_bar(true) .title_bar(true)
.resizable(false) .resizable(false)
.show(egui_ctx.ctx_mut(), |ui| { .show(egui_ctx.ctx_mut(), |ui| {
for sd in shapes.iter() { for (e, sd) in shapes.iter() {
ui.push_id(e.id(), |ui| {
ui.collapsing(format!("{:?}", sd.shape), |ui| { ui.collapsing(format!("{:?}", sd.shape), |ui| {
if let Ok(mut t) = transforms.get_mut(sd.main_shape) { if let Ok(mut t) = transforms.get_mut(sd.main_shape) {
@ -98,6 +100,7 @@ pub fn shape_tree_sys(
}); });
} }
}); });
});
} }
}); });
} }