refactor(react/internal-nodes): cleanup
This commit is contained in:
@@ -136,8 +136,18 @@ const createRFStore = ({
|
||||
dragging,
|
||||
};
|
||||
|
||||
if (internalNode?.expandParent) {
|
||||
triggerChangeNodes.push(internalNode);
|
||||
if (internalNode?.expandParent && change.position) {
|
||||
triggerChangeNodes.push({
|
||||
...internalNode,
|
||||
position: change.position,
|
||||
internals: {
|
||||
...internalNode.internals,
|
||||
positionAbsolute: node.internals.positionAbsolute,
|
||||
},
|
||||
});
|
||||
|
||||
change.position.x = Math.max(0, change.position.x);
|
||||
change.position.y = Math.max(0, change.position.y);
|
||||
}
|
||||
|
||||
return change;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user