graflow: fix1 to ortho wires

This commit is contained in:
STEINNI
2026-03-02 18:27:15 +00:00
parent 070be08dee
commit 2e6689b678

View File

@@ -499,14 +499,19 @@ class BZgraflow extends Buildoz{
return(`M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`) return(`M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`)
} }
if(wireType === 'straight') { if(wireType === 'straight') {
console.log('straight')
// Straight segments through the same control points
return(`M ${x1} ${y1} L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`) return(`M ${x1} ${y1} L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`)
} }
return('') if(wireType === 'ortho') {
//return(`M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`) let path = `M ${x1} ${y1} `
if(['n', 's'].includes(port1.direction)) {
path += `V ${(c1y+c2y)/2} H ${c2x} V ${y2}`
} else {
path += `H ${(c1x+c2x)/2} V ${c2y} H ${x2}`
}
return(path)
}
return('')
} }
linkInterNodes(idNode1, idPort1, idNode2, idPort2, interNodes, orientation='horizontal') { linkInterNodes(idNode1, idPort1, idNode2, idPort2, interNodes, orientation='horizontal') {
const tension = parseInt(this.getBZAttribute('tension')) || 60 const tension = parseInt(this.getBZAttribute('tension')) || 60
const wireType = this.getBZAttribute('wiretype') || 'bezier' const wireType = this.getBZAttribute('wiretype') || 'bezier'
@@ -541,7 +546,16 @@ class BZgraflow extends Buildoz{
if(wireType === 'straight') { if(wireType === 'straight') {
return(`L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`) return(`L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`)
} }
return(`C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`) if(wireType === 'ortho') {
let path = `M ${x1} ${y1} `
if(['n', 's'].includes(port1.direction)) {
path += `V ${(c1y+c2y)/2} H ${c2x} V ${y2}`
} else {
path += `H ${(c1x+c2x)/2} V ${c2y} H ${x2}`
}
return(path)
}
return(``)
} }
// Start/end points in SVG coords (works for both bezier and line) // Start/end points in SVG coords (works for both bezier and line)