Skip to content

Commit

Permalink
hacky autosave on each change, for now just dump it all in autosave.json
Browse files Browse the repository at this point in the history
  • Loading branch information
onsdagens committed Oct 12, 2023
1 parent 2ec424f commit ccfcfee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui_egui/library.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::common::EguiComponent;
use crate::common::{EguiComponent, ComponentStore};
use crate::gui_egui::gui::EguiExtra;
use crate::gui_egui::{
editor::{Editor, EditorMode},
editor_wire_mode::get_grid_snap,
helper::{id_ports_of_all_components, offset_reverse_helper_pos2, unique_component_name},
};
use egui::{Context, CursorIcon, LayerId, PointerButton, Pos2, Rect, Response, Ui, Vec2};
use std::{collections::HashMap, rc::Rc};
use std::{collections::HashMap, rc::Rc, path::PathBuf};

pub struct InputMode {
pub comp: Option<Rc<dyn EguiComponent>>,
Expand Down Expand Up @@ -153,4 +153,6 @@ pub fn add_comp_to_editor(e: &mut Editor) {
},
);
e.components.push(*instance);
let path = PathBuf::from("autosave.json");
ComponentStore{store:e.components.clone()}.save_file(&path);
}

0 comments on commit ccfcfee

Please sign in to comment.