From 024c8579f6c8739c4ecdc4acf18e28dd595ee813 Mon Sep 17 00:00:00 2001 From: WanderingPenwing Date: Thu, 29 Feb 2024 18:16:41 +0100 Subject: [PATCH] fixed project mode item edit --- src/core/ui.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/core/ui.rs b/src/core/ui.rs index e0716ee..5730202 100644 --- a/src/core/ui.rs +++ b/src/core/ui.rs @@ -295,7 +295,7 @@ impl Calcifer { ui.separator(); if self.tabs[self.selected_tab].language == PROJECT_EXTENSION { - self.draw_project_file(ui); + self.draw_project_file(ctx, ui); } else { self.draw_code_file(ui); } @@ -332,20 +332,13 @@ impl Calcifer { ); } - fn draw_project_file(&mut self, ui: &mut egui::Ui) { + fn draw_project_file(&mut self, ctx: &egui::Context, ui: &mut egui::Ui) { let current_tab = &mut self.tabs[self.selected_tab]; self.project_content .update_from_code(current_tab.code.clone()); panels::draw_project(ui, self.theme, &mut self.project_content); - - match self.project_content.save_to_code() { - Ok(code) => current_tab.code = code, - Err(_err) => (), - } - } - - pub fn draw_windows(&mut self, ctx: &egui::Context) { + if self.project_content.item_window.visible { if self.project_content.categories.len() > 1 && !self.project_content.categories[self.project_content.selected_item.category] @@ -362,6 +355,14 @@ impl Calcifer { self.project_content.item_window.visible = false; } } + + match self.project_content.save_to_code() { + Ok(code) => current_tab.code = code, + Err(_err) => (), + } + } + + pub fn draw_windows(&mut self, ctx: &egui::Context) { if self.search_menu.visible { self.search_menu .show(ctx, &mut self.tabs, &mut self.selected_tab);