diff --git a/app/assets/html/bzGraflow/nodes16ports.html b/app/assets/html/bzGraflow/nodes16ports.html new file mode 100644 index 0000000..cab951a --- /dev/null +++ b/app/assets/html/bzGraflow/nodes16ports.html @@ -0,0 +1,59 @@ + + + + diff --git a/app/assets/html/test.html b/app/assets/html/test.html index 93d4348..344cf3e 100644 --- a/app/assets/html/test.html +++ b/app/assets/html/test.html @@ -14,6 +14,8 @@
  • test4 (EIC-ICMP + NON-ISOLATED)
  • test4.5 (EIC-ICMP + NON-ISOLATED + single-port, ortho, oriented, aligned top)
  • test5 (P42 graph + ISOLATED + EDITABLE)
  • +
  • test6 (16 port combinations)
  • + diff --git a/app/assets/html/test6.html b/app/assets/html/test6.html new file mode 100644 index 0000000..6c3bfce --- /dev/null +++ b/app/assets/html/test6.html @@ -0,0 +1,99 @@ + + + + graflow + + + + + + + + + + + + +
    + + + + +
    +
    +
    + + + diff --git a/app/assets/json/bzGraflow/testFlow16ports.json b/app/assets/json/bzGraflow/testFlow16ports.json new file mode 100644 index 0000000..a04fc6e --- /dev/null +++ b/app/assets/json/bzGraflow/testFlow16ports.json @@ -0,0 +1,53 @@ +{ + "nodesFile": "/app/assets/html/bzGraflow/nodes16ports.html", + "flow": { + "nodes":[ + { "nodeType": "square", + "id": "p1center", + "coords": { "x": 500, "y": 200}, + "markup": { + "title": "Center", + "subtitle": "." + } + }, + { "nodeType": "square", + "id": "p1west", + "coords": { "x": 400, "y": 200}, + "markup": { + "title": "West", + "subtitle": "." + } + }, + { "nodeType": "square", + "id": "p1north", + "coords": { "x": 500, "y": 100}, + "markup": { + "title": "North", + "subtitle": "." + } + }, + { "nodeType": "square", + "id": "p1east", + "coords": { "x": 600, "y": 200}, + "markup": { + "title": "East", + "subtitle": "." + } + }, + { "nodeType": "square", + "id": "p1south", + "coords": { "x": 500, "y": 300}, + "markup": { + "title": "South", + "subtitle": "." + } + } + ], + "links": [ + { "from": ["p1center", "s"], "to": ["p1south", "n"] }, + { "from": ["p1center", "e"], "to": ["p1east", "w"] }, + { "from": ["p1center", "n"], "to": ["p1north", "s"] }, + { "from": ["p1center", "w"], "to": ["p1west", "e"] } + ] + } +} \ No newline at end of file diff --git a/app/thirdparty/buildoz/bzGraflow.js b/app/thirdparty/buildoz/bzGraflow.js index b87b54f..7431b5a 100644 --- a/app/thirdparty/buildoz/bzGraflow.js +++ b/app/thirdparty/buildoz/bzGraflow.js @@ -459,20 +459,18 @@ class BZgraflow extends Buildoz{ return({ x: x - r.left, y: y - r.top }) } - emitWireSegment(x1, y1, c1x, c1y, c2x, c2y, x2, y2, wireType, startAxis, loop=false){ + buildSegment(x1, y1, c1x, c1y, c2x, c2y, x2, y2, wireType, startAxis, loop=false){ if(loop) wireType = 'bezier' // loops only use bezier to look good - if(wireType === 'bezier'){ + if(wireType == 'bezier'){ return(`C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`) } - if(wireType === 'straight'){ + if(wireType == 'straight'){ return(`L ${c1x} ${c1y} L ${c2x} ${c2y} L ${x2} ${y2}`) } - if(wireType === 'ortho'){ - if(startAxis === 'v'){ - return(`V ${(c1y + c2y) / 2} H ${c2x} V ${y2}`) - } - return(`H ${(c1x + c2x) / 2} V ${c2y} H ${x2}`) + if(wireType == 'ortho'){ + if(startAxis == 'v') return(`V ${(c1y + c2y) / 2} H ${c2x} V ${y2}`) + else return(`H ${(c1x + c2x) / 2} V ${c2y} H ${x2}`) } return('') } @@ -513,10 +511,11 @@ class BZgraflow extends Buildoz{ } } const startAxis = ['n', 's'].includes(port1.direction) ? 'v' : 'h' - const seg = this.emitWireSegment(x1, y1, c1x, c1y, c2x, c2y, x2, y2, wireType, startAxis, loop) + const seg = this.buildSegment(x1, y1, c1x, c1y, c2x, c2y, x2, y2, wireType, startAxis, loop) if(!seg) return('') return(`M ${x1} ${y1} ${seg}`) } + linkInterNodes(idNode1, idPort1, idNode2, idPort2, interNodes, orientation='horizontal') { const tension = parseInt(this.getBZAttribute('tension')) || 60 const wireType = this.getBZAttribute('wiretype') || 'bezier' @@ -546,7 +545,7 @@ class BZgraflow extends Buildoz{ c2y = Math.floor(y2 - tension) } const startAxis = (orientation1=='vertical') ? 'v' : 'h' - return(this.emitWireSegment(x1, y1, c1x, c1y, c2x, c2y, x2, y2, wireType, startAxis, false)) + return(this.buildSegment(x1, y1, c1x, c1y, c2x, c2y, x2, y2, wireType, startAxis, false)) } // Start/end points in SVG coords (works for both bezier and line)