From 2ac276da6d60c8124d31b36b37341147842aaccb Mon Sep 17 00:00:00 2001 From: STEINNI Date: Sun, 8 Feb 2026 12:49:13 +0000 Subject: [PATCH] graflow: cleanup minTension VS tension --- bzGraflow.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bzGraflow.js b/bzGraflow.js index c367072..eb698b4 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -251,7 +251,8 @@ testEl.classList.add('eic') } } - bezierNodes(idNode1, idPort1, idNode2, idPort2, tensionMin=60) { + bezierNodes(idNode1, idPort1, idNode2, idPort2, tension=60) { + tension = parseInt(tension) const svgRect = this.wiresContainer.getBoundingClientRect() const node1 = this.stagedNodes[idNode1] const port1 = node1.ports[idPort1] @@ -269,9 +270,6 @@ testEl.classList.add('eic') const y2 = Math.floor(bb2.y + (bb2.height/2)) - svgRect.top const loop = (idNode1==idNode2) && (idPort1==idPort2) const dist = Math.abs(x2 - x1) + Math.abs(y2 - y1) - let tension = dist * 0.4 - if(tension < tensionMin) tension = parseInt(tensionMin) - let c1x = Math.floor(x1 + (this.dirVect[port1.direction].x * tension)) let c1y = Math.floor(y1 + (this.dirVect[port1.direction].y * tension)) @@ -290,16 +288,15 @@ testEl.classList.add('eic') return(`M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`) } - bezierInterNodes(idNode1, idPort1, idNode2, idPort2, interNodes, orientation='horizontal', tensionMin=60) { + bezierInterNodes(idNode1, idPort1, idNode2, idPort2, interNodes, orientation='horizontal', tension=60) { + tension = parseInt(tension) const svgRect = this.wiresContainer.getBoundingClientRect() const node1 = this.stagedNodes[idNode1] let port1 = node1.ports[idPort1] const makeCubicBezier = (x1, y1, x2, y2, orientation1, orientation2) => { const dist = Math.abs(x2 - x1) + Math.abs(y2 - y1) - let tension = dist * 0.4 - // if(tension < tensionMin) - tension = parseInt(tensionMin) + let c1x, c1y, c2x, c2y if(orientation1=='horizontal'){ c1x = Math.floor(x1 + tension) @@ -317,7 +314,7 @@ testEl.classList.add('eic') } return(`C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`) } - const directPath = this.bezierNodes(idNode1, idPort1, idNode2, idPort2, tensionMin) + const directPath = this.bezierNodes(idNode1, idPort1, idNode2, idPort2, tension) const startPath = directPath.substring(0,directPath.indexOf('C')) const endPath = directPath.substring(directPath.lastIndexOf(',')+1).trim() let path = startPath