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

Fixed undo/redo

parent a97b8424
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,7 @@ export class Graph extends ManagedData {
}
getLinkColor(link) {
return this.getLinkTypeColor(link[LINK_TYPE])
return this.getLinkTypeColor(link[LINK_TYPE]);
}
getLinkTypeColor(linkClass) {
......@@ -223,10 +223,18 @@ export class Graph extends ManagedData {
getCleanLink(link, simulationParameters) {
var cleanLink = {};
// Source and target nodes
// Node ids will be converted to complete node objects on running graphs, gotta convert back
cleanLink[LINK_SOURCE] = link[LINK_SOURCE][NODE_ID];
cleanLink[LINK_TARGET] = link[LINK_TARGET][NODE_ID];
// Assuming that all nodes are valid, there are two possible formats
// 1. source and target are node objects
if (link[LINK_SOURCE][NODE_ID] !== undefined) {
// Source and target nodes
// Node ids will be converted to complete node objects on running graphs, gotta convert back
cleanLink[LINK_SOURCE] = link[LINK_SOURCE][NODE_ID];
cleanLink[LINK_TARGET] = link[LINK_TARGET][NODE_ID];
} else {
// 2. source and target are just node ids
cleanLink[LINK_SOURCE] = link[LINK_SOURCE];
cleanLink[LINK_TARGET] = link[LINK_TARGET];
}
// Other parameters
LINK_PARAMS.forEach((param) => {
......
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