wip: multiple edge renderers

This commit is contained in:
Christopher Möller
2021-11-03 17:51:39 +01:00
parent 7333873822
commit 79e46d90ad
10 changed files with 201 additions and 275 deletions
+2 -33
View File
@@ -40,39 +40,6 @@ const createNodeOrEdgeSelectionChange = (isSelected: boolean) => (item: Node | E
isSelected,
});
// @todo needs refactoring / improvements
// function findMatchingNodes(id: string | undefined, nodes: Node[]): Node[] {
// if (!id) {
// return nodes.filter((n) => !!n.isSelected);
// }
// const result = [];
// const children = [];
// for (let i = 0; i < nodes.length; i++) {
// const n = nodes[i];
// if (n.id === id) {
// result.push(n);
// }
// if (n.parentNode === id) {
// children.push(n);
// }
// }
// for (let i = 0; i < children.length; i++) {
// const n = children[i];
// const matches = findMatchingNodes(n.id, nodes);
// for (let j = 0; j < matches.length; j++) {
// result.push(matches[j]);
// }
// }
// return result;
// }
type XYPosAndTreeLevel = XYPosition & { treeLevel: number };
function addPositions(a: XYPosAndTreeLevel, b: XYPosition): XYPosAndTreeLevel {
@@ -185,6 +152,8 @@ const createStore = () =>
treeLevel: 0,
});
nodeLookup.set(node.parentNode!, { ...nodeLookup.get(node.parentNode!), isParentNode: true });
if (positionAbsoluteAndTreeLevel) {
nodeLookup.set(node.id, {
...nodeLookup.get(node.id),