Delete nodes from egui
This commit is contained in:
parent
f699cc61e3
commit
767af41736
@ -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)]
|
||||||
|
Loading…
Reference in New Issue
Block a user