in packages/core/src/models/SnapLine.ts [70:113]
resize(node: TreeNode, rect: Rect) {
if (!node || !node?.parent) return
const parent = node.parent
const dragNodeRect = node.getValidElementOffsetRect()
const parentRect = parent.getValidElementOffsetRect()
const edgeOffset = calcOffsetOfSnapLineSegmentToEdge(this, dragNodeRect)
const cursorRect = this.helper.cursorDragNodesRect
const snapEdge = this.snapEdge(rect)
if (this.direction === 'h') {
const y = this.start.y - parentRect.y - edgeOffset.y
switch (this.helper.direction) {
case 'left-top':
case 'center-top':
case 'right-top':
if (snapEdge !== 'ht') return
rect.y = y
rect.height = cursorRect.bottom - y
break
case 'left-bottom':
case 'center-bottom':
case 'right-bottom':
if (snapEdge !== 'hb') return
rect.height = this.start.y - cursorRect.top
break
}
} else {
const x = this.start.x - parentRect.x - edgeOffset.x
switch (this.helper.direction) {
case 'left-top':
case 'left-bottom':
case 'left-center':
if (snapEdge !== 'vl') return
rect.x = x
rect.width = cursorRect.right - x
break
case 'right-center':
case 'right-top':
case 'right-bottom':
if (snapEdge !== 'vr') return
rect.width = this.start.x - cursorRect.left
break
}
}
}