(nodeList: FlowNode[], positions?: Map<string, { x: number; y: number }>)
| 299 | }; |
| 300 | |
| 301 | const hasAnyOverlapInFlow = (nodeList: FlowNode[], positions?: Map<string, { x: number; y: number }>): boolean => { |
| 302 | const inFlow = nodeList.filter((n) => inSameFlow.has(n.id)); |
| 303 | const posMap = positions ?? buildPositionsMap(nodeList); |
| 304 | for (let i = 0; i < inFlow.length; i++) { |
| 305 | const a = inFlow[i]; |
| 306 | const pa = posMap.get(a.id) ?? a.position; |
| 307 | const dimA = nodeDimensions.get(a.id) || { width: DEFAULT_NODE_WIDTH, height: DEFAULT_NODE_HEIGHT }; |
| 308 | const boxA: Box = { id: a.id, x: pa.x, y: pa.y, w: dimA.width, h: dimA.height }; |
| 309 | for (let j = i + 1; j < inFlow.length; j++) { |
| 310 | const b = inFlow[j]; |
| 311 | const pb = posMap.get(b.id) ?? b.position; |
| 312 | const dimB = nodeDimensions.get(b.id) || { width: DEFAULT_NODE_WIDTH, height: DEFAULT_NODE_HEIGHT }; |
| 313 | const boxB: Box = { id: b.id, x: pb.x, y: pb.y, w: dimB.width, h: dimB.height }; |
| 314 | if (boxesOverlap(boxA, boxB, pad)) return true; |
| 315 | } |
| 316 | } |
| 317 | return false; |
| 318 | }; |
| 319 | |
| 320 | const maxIters = 20; |
| 321 | for (let iter = 0; iter < maxIters; iter++) { |
no test coverage detected