Skip to content
Snippets Groups Projects
Commit 57b6e001 authored by Maximilian Giller's avatar Maximilian Giller :squid:
Browse files

Fixed bug in deleting elements

parent 36151759
No related branches found
No related tags found
1 merge request!2Implemented editor in the react framework
Pipeline #56564 passed
......@@ -122,7 +122,7 @@ export class Graph extends ManagedData {
const clean: GraphData = {
nodes: [],
links: [],
types: []
types: [],
};
clean.links = data.links.map((link) => link.getCleanInstance());
......@@ -181,7 +181,7 @@ export class Graph extends ManagedData {
return true; // Doesn't even exist in graph to begin with.
}
this.data.nodes.filter((n: Node) => n !== node);
this.data.nodes = this.data.nodes.filter((n: Node) => n.id !== node.id);
try {
// No save points should be created when deleting the links
......@@ -218,7 +218,7 @@ export class Graph extends ManagedData {
return true; // Already exists in graph.
}
// Updateid
// Update id
link.id = this.nextLinkId;
this.nextLinkId += 1;
......@@ -241,7 +241,10 @@ export class Graph extends ManagedData {
return true; // Doesn't even exist in graph to begin with.
}
this.data.links.filter((l: Link) => l !== link);
this.data.links = this.data.links.filter(
(l: Link) =>
l.sourceId !== link.sourceId || l.targetId !== link.targetId
);
this.triggerOnChange();
// TODO: Use toString implementation of link
......@@ -254,7 +257,7 @@ export class Graph extends ManagedData {
const data: GraphData = {
nodes: [],
links: [],
types: []
types: [],
};
// Parse nodes
......
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