refactor(libs) add width, height and positionAbsolute props to NodeProps

This commit is contained in:
moklick
2023-11-23 13:50:28 +01:00
parent 38b5051179
commit 1dfff1bf5b
16 changed files with 63 additions and 49 deletions
+3 -2
View File
@@ -52,8 +52,9 @@ export type NodeProps<T = any> = {
selected: NodeBase['selected'];
isConnectable: NodeBase['connectable'];
zIndex: NodeBase['zIndex'];
xPos: number;
yPos: number;
positionAbsolute: XYPosition;
width?: number;
height?: number;
dragging: boolean;
targetPosition?: Position;
sourcePosition?: Position;
+2 -2
View File
@@ -254,8 +254,8 @@ export function calcNextPosition<NodeType extends NodeBase>(
? [
[parentPos.x + nodeWidth * currNodeOrigin[0], parentPos.y + nodeHeight * currNodeOrigin[1]],
[
parentPos.x + parentNode.computed.width - nodeWidth + nodeWidth * currNodeOrigin[0],
parentPos.y + parentNode.computed.height - nodeHeight + nodeHeight * currNodeOrigin[1],
parentPos.x + (parentNode.computed?.width ?? 0) - nodeWidth + nodeWidth * currNodeOrigin[0],
parentPos.y + (parentNode.computed?.height ?? 0) - nodeHeight + nodeHeight * currNodeOrigin[1],
],
]
: currentExtent;