added copy and delete to object and templates

This commit is contained in:
2025-07-15 14:56:28 +01:00
parent 76ec44d4e6
commit 1117ce9f13
6 changed files with 92 additions and 37 deletions
+11 -5
View File
@@ -159,16 +159,23 @@ impl eframe::App for Interface {
// Main content area
egui::SidePanel::right("templates").show(ctx, |ui| {
let mut new_instance: RightPanelContent = RightPanelContent::None;
let mut new_instance: Option<RightPanelContent> = None;
match &mut self.right_panel_content {
// an instance of a template
RightPanelContent::Object { object } => {
// load template from path
let mut right_panel = None;
let template = Template::load(&object.template_id).unwrap();
ScrollArea::vertical().show(ui, |ui| {
object.ui(ui, &template);
object.ui(ui, &template, &mut right_panel);
});
if let Some(right_panel) = right_panel {
self.right_panel_content = right_panel;
}
}
// an editable template
@@ -199,9 +206,8 @@ impl eframe::App for Interface {
}
};
if let RightPanelContent::None = new_instance {
} else {
self.right_panel_content = new_instance;
if let Some(new) = new_instance {
self.right_panel_content = new;
}
});