Fixed rerendering of edges & simplified rerendering of nodes

This commit is contained in:
peterkogo
2024-12-12 12:11:07 +01:00
parent 24735aa003
commit 9105d22c46
6 changed files with 31 additions and 24 deletions
@@ -28,10 +28,17 @@
continue;
}
// we reuse the previous edge object if the source and target node are the same as before
// references to internalNodes that haven't changed stay the same
// we reuse the previous edge object if
// the current and previous edge are the same
// and the source and target node are the same
// and references to internalNodes are the same
const previous = previousLayoutedEdges.get(edge.id);
if (previous && sourceNode == previous.sourceNode && targetNode == previous.targetNode) {
if (
previous &&
edge == previous.edge &&
sourceNode == previous.sourceNode &&
targetNode == previous.targetNode
) {
layoutedEdges.set(edge.id, previous);
continue;
}
@@ -58,7 +65,8 @@
}),
...edgePosition,
sourceNode,
targetNode
targetNode,
edge
});
}
}