graflow: cleanup minTension VS tension

This commit is contained in:
STEINNI
2026-02-08 12:49:13 +00:00
parent 6d72f6ef8e
commit 2ac276da6d

View File

@@ -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