diff --git a/components/graph/layout-engine.js b/components/graph/layout-engine.js index 5592f71..46e5f19 100644 --- a/components/graph/layout-engine.js +++ b/components/graph/layout-engine.js @@ -91,7 +91,8 @@ module.exports = class LayoutEngine { node.y = offsetY + (direction * (Math.floor(columnHeight / 2) - 1) * (size + margin)); let intersected = true; - while (intersected) { + let iterations = 0; + while (intersected && iterations < 10) { intersected = false; for (const otherNode of nodes) { if (otherNode.type === 'satellite') { @@ -102,6 +103,8 @@ module.exports = class LayoutEngine { continue; } + iterations += 1; + if (this.nodesIntersect(node, otherNode)) { node.y += direction * (size + margin); intersected = true;