added copy and delete to object and templates
This commit is contained in:
+11
-5
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user