refactor(react/internal-nodes): cleanup

This commit is contained in:
moklick
2024-04-03 12:54:55 +02:00
parent 6753c19188
commit f45f50671d
2 changed files with 31 additions and 22 deletions
+19 -20
View File
@@ -91,28 +91,27 @@ export function adoptUserProvidedNodes<NodeType extends NodeBase>(
parentNodeIds.add(n.parentNode);
}
if (n === currentStoreNode?.internals?.userProvidedNode) {
if (n === currentStoreNode?.internals.userProvidedNode) {
nodeLookup.set(n.id, currentStoreNode);
return currentStoreNode;
} else {
const node: InternalNodeBase<NodeType> = {
...options.defaults,
...n,
computed: {
width: n.computed?.width,
height: n.computed?.height,
},
internals: {
positionAbsolute: n.position,
handleBounds: currentStoreNode?.internals?.handleBounds,
z: (isNumeric(n.zIndex) ? n.zIndex : 0) + (n.selected ? selectedNodeZ : 0),
userProvidedNode: n,
isParent: false,
},
};
nodeLookup.set(node.id, node);
}
const node: InternalNodeBase<NodeType> = {
...options.defaults,
...n,
computed: {
width: n.computed?.width,
height: n.computed?.height,
},
internals: {
positionAbsolute: n.position,
handleBounds: currentStoreNode?.internals?.handleBounds,
z: (isNumeric(n.zIndex) ? n.zIndex : 0) + (n.selected ? selectedNodeZ : 0),
userProvidedNode: n,
isParent: false,
},
};
nodeLookup.set(node.id, node);
});
if (parentNodeIds.size > 0) {