feat(nodes): add prop to disable automatic elevation of nodes on select

This commit is contained in:
Christopher Möller
2022-12-15 18:57:01 +01:00
parent 7ef2910808
commit 7318210a2c
8 changed files with 22 additions and 8 deletions
+4 -2
View File
@@ -46,13 +46,15 @@ function calculateXYZPosition(
export function createNodeInternals(
nodes: Node[],
nodeInternals: NodeInternals,
nodeOrigin: NodeOrigin
nodeOrigin: NodeOrigin,
elevateNodesOnSelect: boolean
): NodeInternals {
const nextNodeInternals = new Map<string, Node>();
const parentNodes: ParentNodes = {};
const selectedNodeZ: number = elevateNodesOnSelect ? 1000 : 0;
nodes.forEach((node) => {
const z = (isNumeric(node.zIndex) ? node.zIndex : 0) + (node.selected ? 1000 : 0);
const z = (isNumeric(node.zIndex) ? node.zIndex : 0) + (node.selected ? selectedNodeZ : 0);
const currInternals = nodeInternals.get(node.id);
const internals: Node = {