diff --git a/public/air.bmp b/public/air.bmp deleted file mode 100644 index 0c52e44..0000000 Binary files a/public/air.bmp and /dev/null differ diff --git a/src/components/Graph.vue b/src/components/Graph.vue index 2ee0525..b966a5f 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -106,7 +106,7 @@ export default { (stepId) => highlight(stepId) ); - // Methodsc + // Methods const highlight = (stepId) => { if (loop === null) return; @@ -130,6 +130,15 @@ export default { activateNodes([current.source, current.target]); }; + const hasntIntersections = (node) => { + return nodes.value.every((current) => { + return ( + (RADIUS * 2) ** 2 < + (node.x - current.x) ** 2 + (node.y - current.y) ** 2 + ); + }); + }; + const loopPosition = (coords) => { const node = nodes.value[coords]; @@ -185,8 +194,10 @@ export default { selected: 0, }; - nodes.value.push(newNode); - emit("hasVertices", nodes.value.length); + if (hasntIntersections(newNode)) { + nodes.value.push(newNode); + emit("hasVertices", nodes.value.length); + } }; const removeNode = (id) => {