Delete nodes from egui

This commit is contained in:
Dane Johnson 2022-05-10 15:33:32 -05:00
parent f699cc61e3
commit 767af41736
2 changed files with 9 additions and 1 deletions

View File

@ -184,6 +184,7 @@ impl BoardBuilderApp {
match (btn, self.edit_mode) { match (btn, self.edit_mode) {
(Primary, Nodes) => self.create_node_dialog.show(x, y), (Primary, Nodes) => self.create_node_dialog.show(x, y),
(Primary, Edges) => self.select_edge(x, y), (Primary, Edges) => self.select_edge(x, y),
(Secondary, Nodes) => self.delete_node(x, y),
_ => {}, _ => {},
} }
} }
@ -197,6 +198,13 @@ impl BoardBuilderApp {
} }
} }
} }
fn delete_node(&mut self, x: f32, y: f32) {
if let Some(nearest_id) = self.board.nearest_node(x, y) {
self.board.remove_node(nearest_id);
}
}
} }
#[derive(Clone, Copy)] #[derive(Clone, Copy)]

BIN
board.zip

Binary file not shown.