change incrementation
This commit is contained in:
@@ -120,7 +120,7 @@ export function adoptUserNodes<NodeType extends NodeBase>(
|
||||
): boolean {
|
||||
const _options = mergeObjects(adoptUserNodesDefaultOptions, options);
|
||||
|
||||
let rootParentIndex = { i: -1 };
|
||||
let rootParentIndex = { i: 0 };
|
||||
let nodesInitialized = nodes.length > 0;
|
||||
const tmpLookup = new Map(nodeLookup);
|
||||
const selectedNodeZ: number = _options?.elevateNodesOnSelect ? 1000 : 0;
|
||||
@@ -216,7 +216,7 @@ function updateChildNode<NodeType extends NodeBase>(
|
||||
|
||||
// We just want to set the rootParentIndex for the first child
|
||||
if (rootParentIndex && !parentNode.parentId && parentNode.internals.rootParentIndex === undefined) {
|
||||
parentNode.internals.rootParentIndex = ++rootParentIndex.i;
|
||||
parentNode.internals.rootParentIndex = rootParentIndex.i++;
|
||||
parentNode.internals.z = parentNode.internals.z + rootParentIndex.i * 10;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user