Add values, complete the board edges and nodes wise

This commit is contained in:
Dane Johnson 2022-05-11 16:13:22 -05:00
parent 92b0d5cb01
commit da1c4b7f3f
3 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@ use rfd::FileDialog;
use board_builder::{ Board, CoordTransformer, read_board_from_file, write_board_to_file };
use std::path::Path;
use std::collections::HashSet;
use std::rc::Rc;
use std::cell::RefCell;
@ -303,9 +304,15 @@ impl EditLabelsDialog {
if self.add_key_dialog.open {
if let StringDialogResponse::Accepted(key) =
self.add_key_dialog.ui(ui, "Add Key") {
board.labels.insert(key, Vec::new());
board.labels.insert(key, HashSet::new());
}
}
if self.add_value_dialog.open && selected_label_key != &String::new() {
if let StringDialogResponse::Accepted(value) =
self.add_value_dialog.ui(ui, "Add Value") {
board.labels.get_mut(selected_label_key).unwrap().insert(value);
}
}
});
}
}

BIN
board.zip

Binary file not shown.

View File

@ -14,7 +14,7 @@ pub struct Node {
#[derive(Serialize, Deserialize, Debug, Default)]
#[serde(default)]
pub struct Board {
pub labels: HashMap<String, Vec<String>>,
pub labels: HashMap<String, HashSet<String>>,
pub nodes: HashMap<usize, Node>,
}
impl Board {