Skip to content
Snippets Groups Projects
Commit 8cf85003 authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Fixed some ghost selection glitches

parent a3188f86
No related branches found
No related tags found
No related merge requests found
import Tool from "./tool"; import Tool from "./tool";
import { graph } from "../editor"; import { graph, state } from "../editor";
import * as Graph from "../graph"; import * as Graph from "../graph";
export default class DeleteTool extends Tool { export default class DeleteTool extends Tool {
...@@ -9,6 +9,10 @@ export default class DeleteTool extends Tool { ...@@ -9,6 +9,10 @@ export default class DeleteTool extends Tool {
onNodeClick(node) { onNodeClick(node) {
graph.deleteNode(node[Graph.NODE_ID]); graph.deleteNode(node[Graph.NODE_ID]);
if (state.selectedItem == node) {
state.setSelectedItem(undefined);
}
} }
onLinkClick(link) { onLinkClick(link) {
...@@ -16,5 +20,9 @@ export default class DeleteTool extends Tool { ...@@ -16,5 +20,9 @@ export default class DeleteTool extends Tool {
link[Graph.LINK_SOURCE][Graph.NODE_ID], link[Graph.LINK_SOURCE][Graph.NODE_ID],
link[Graph.LINK_TARGET][Graph.NODE_ID] link[Graph.LINK_TARGET][Graph.NODE_ID]
); );
if (state.selectedItem == link) {
state.setSelectedItem(undefined);
}
} }
} }
...@@ -28,4 +28,17 @@ export default class SelectTool extends Tool { ...@@ -28,4 +28,17 @@ export default class SelectTool extends Tool {
graph.changeDetails(value); graph.changeDetails(value);
} }
} }
onToolActivate() {
if (state === undefined) {
return;
}
var newSelection = state.selectedItem;
if (newSelection === undefined) {
newSelection = {};
}
this.menu.value(SelectMenu.SELECTION_KEY, newSelection);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment