MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / hasAnyOverlapInFlow

Function hasAnyOverlapInFlow

yaml-flow-editor/src/utils/layout.ts:301–318  ·  view source on GitHub ↗
(nodeList: FlowNode[], positions?: Map<string, { x: number; y: number }>)

Source from the content-addressed store, hash-verified

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++) {

Callers 1

resolveOverlapsForNodeFunction · 0.85

Calls 3

buildPositionsMapFunction · 0.85
boxesOverlapFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected