Skip to content
Snippets Groups Projects
Commit c8b65b64 authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Fixed strange group deletion bugs

parent 9aad12f1
No related branches found
No related tags found
No related merge requests found
......@@ -233,9 +233,9 @@ export class Editor extends React.PureComponent<any, stateTypes> {
return node;
}
private handleNodeDeletion(id: number) {
private handleNodeDeletion(ids: number[]) {
const graph = Object.assign(new DynamicGraph(), this.state.graph);
graph.deleteNode(id);
ids.forEach((id) => graph.deleteNode(id));
this.setState({ graph: graph });
}
......@@ -247,9 +247,9 @@ export class Editor extends React.PureComponent<any, stateTypes> {
return link;
}
private handleLinkDeletion(id: number) {
private handleLinkDeletion(ids: number[]) {
const graph = Object.assign(new DynamicGraph(), this.state.graph);
graph.deleteLink(id);
ids.forEach((id) => graph.deleteLink(id));
this.setState({ graph: graph });
}
......
......@@ -86,8 +86,8 @@ export class GraphRenderer2D extends React.PureComponent<
key === "Delete" &&
this.graphInFocus // Only delete if 2d-graph is the focused element
) {
this.props.selectedNodes.forEach((node: Node) =>
this.props.onNodeDeletion(node.id)
this.props.onNodeDeletion(
this.props.selectedNodes.map((node: Node) => node.id)
);
this.props.onNodeSelectionChanged([]);
}
......@@ -395,12 +395,12 @@ export class GraphRenderer2D extends React.PureComponent<
nodeColor={(node: Node) => node.type.color}
onNodeDrag={this.handleNodeDrag}
onLinkRightClick={(link: Link) =>
this.props.onLinkDeletion(link.id)
this.props.onLinkDeletion([link.id])
}
onNodeRightClick={(node: Node) =>
this.props.onNodeDeletion(node.id)
this.props.onNodeDeletion([node.id])
}
onBackgroundClick={(event: any) =>
onBackgroundClick={(event: MouseEvent) =>
this.handleBackgroundClick(
event,
this.extractPositions(event)
......
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