diff --git a/app/assets/html/bzGraflow/nodesEIC.html b/app/assets/html/bzGraflow/nodesEIC.html index f7839c0..f56a84e 100644 --- a/app/assets/html/bzGraflow/nodesEIC.html +++ b/app/assets/html/bzGraflow/nodesEIC.html @@ -32,14 +32,22 @@ position: absolute; height: 10px; width: 10px; - background: var(--eicui-base-color-grey-20); + background: var(--eicui-base-color-info-25); border-radius: 10px; } - .bzgf-node [data-direction="w"]{ left: -4px; top: 50%; transform: translateY(-50%);} - .bzgf-node [data-direction="e"]{ right: -4px; top: 50%; transform: translateY(-50%);} .bzgf-node [data-direction="n"]{ top: -4px; left: 50%; transform: translateX(-50%);} .bzgf-node [data-direction="s"]{ bottom: -4px; left: 50%; transform: translateX(-50%);} + .bzgf-node [data-direction="w"]{ left: -4px; top: 50%; transform: translateY(-50%);} + .bzgf-node [data-direction="e"]{ right: -4px; top: 50%; transform: translateY(-50%);} + + + .bzgf-node [data-id="in2"]{ top: 25%; } + .bzgf-node [data-id="in3"]{ top: 75%; } + + .bzgf-node [data-id="out2"]{ top: 25%; } + .bzgf-node [data-id="out3"]{ top: 75%; } + .bzgf-wire{ stroke: var(--eicui-base-color-info); stroke-width: 4px; stroke-dasharray: 10,5; } @@ -51,7 +59,12 @@
{subtitle}
+
+
+
+
+
diff --git a/app/assets/html/bzGraflow/nodesTest2.html b/app/assets/html/bzGraflow/nodesTest2.html index 933b3b4..404aa15 100644 --- a/app/assets/html/bzGraflow/nodesTest2.html +++ b/app/assets/html/bzGraflow/nodesTest2.html @@ -113,7 +113,7 @@ left: 0; width: 99%; background: black; - clip-path: polygon( 0% 100%, 100% 100%, 100% 50%, 0% 50%); + clip-path: polygon( 0% 110%, 100% 110%, 100% 50%, 0% 50%); } .bzgf-node[data-nodetype="database"] [data-direction="n"]{ top: -17px; } .bzgf-node[data-nodetype="database"] [data-direction="s"]{ bottom: -17px; } diff --git a/app/assets/html/test.html b/app/assets/html/test.html index 84d0570..aa1a82f 100644 --- a/app/assets/html/test.html +++ b/app/assets/html/test.html @@ -25,17 +25,19 @@ border-radius: 5px; text-align: center; z-index:99; + font-size: .7em; + border: 1px solid #999; } .demooptions button{ text-transform: none; - font-size: .8em; margin: 2px; + font-size: 1em; } bz-graflow{ overflow: scroll; } bz-graflow.compunet{ grid-column: 1 / -1; width: 80vw; height: 40vh; background:black; } - bz-graflow.eic{ grid-column: 1 / -1; width: 80vw; height: 20vh; background: var(--eicui-base-color-grey-10); } + bz-graflow.eic{ grid-column: 1 / -1; width: 80vw; height: 30vh; background: var(--eicui-base-color-grey-10); } bz-graflow.organi{ width: 40vw; height: 100vh; background:black; } -
+
+
+ -
+
+
+
+
+ diff --git a/app/assets/json/bzGraflow/testFlowEic.json b/app/assets/json/bzGraflow/testFlowEic.json index 32a2a68..d80d441 100644 --- a/app/assets/json/bzGraflow/testFlowEic.json +++ b/app/assets/json/bzGraflow/testFlowEic.json @@ -28,11 +28,32 @@ "subtitle": "Associate content variables with attendees data" }, "data": { "a": "a3", "b":"b3"} - } + }, + { "nodeType": "eicBasic", + "id": "aze4", + "ncoords": { "x": 150, "y": 320}, + "markup": { + "title": "Schedule mailing", + "subtitle": "Choose time to send the mail" + }, + "data": { "a": "a3", "b":"b3"} + }, + { "nodeType": "eicBasic", + "id": "aze5", + "ncoords": { "x": 150, "y": 320}, + "markup": { + "title": "Stats", + "subtitle": "Access mailing statistics" + }, + "data": { "a": "a3", "b":"b3"} + } ], "links": [ - { "from": ["aze", "out1"], "to": ["aze2", "in1"] }, - { "from": ["aze2", "out1"], "to": ["aze3", "in1"] } + { "from": ["aze2", "out1"], "to": ["aze", "in1"] }, + { "from": ["aze2", "out2"], "to": ["aze3", "in1"] }, + { "from": ["aze", "out1"], "to": ["aze4", "in1"] }, + { "from": ["aze3", "out1"], "to": ["aze4", "in2"] }, + { "from": ["aze4", "out1"], "to": ["aze5", "in1"] } ] } } \ No newline at end of file diff --git a/app/thirdparty/buildoz/bzGraflow.js b/app/thirdparty/buildoz/bzGraflow.js index bee65a6..a94375f 100644 --- a/app/thirdparty/buildoz/bzGraflow.js +++ b/app/thirdparty/buildoz/bzGraflow.js @@ -5,6 +5,7 @@ class BZgraflow extends Buildoz{ this.defaultAttrs = { tension: 100 } this.stagedNodes = { } this.stagedWires = { } + this.arrowDefs = null } static _loadedNodeStyles = new Set() // Allow multi instances or re-loadNodes, but avoid reinjecting same styles ! @@ -71,8 +72,9 @@ class BZgraflow extends Buildoz{ this.nodesRegistry = {} for(const tpl of doc.querySelectorAll('template')){ if(tpl.id=='svg-arrows'){ - this.wiresContainer.appendChild(tpl.querySelector('defs').cloneNode(true)) - this.arrowDefined = true + this.arrowDefs = tpl.querySelector('defs').cloneNode(true) + console.log(this.arrowDefs) + this.wiresContainer.appendChild(this.arrowDefs) } else { const rootEl = tpl.content.querySelector('.bzgf-node') if(!rootEl) continue @@ -118,15 +120,23 @@ class BZgraflow extends Buildoz{ this.stagedWires[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path') this.stagedWires[id].setAttribute('d', path) this.stagedWires[id].setAttribute('fill', 'none') - if(this.arrowDefined && link.endArrow) this.stagedWires[id].setAttribute('marker-end','url(#arrow)') - if(this.arrowDefined && link.startArrow) this.stagedWires[id].setAttribute('marker-start','url(#arrow)') + if(this.arrowDefs && link.endArrow) this.stagedWires[id].setAttribute('marker-end','url(#arrow)') + if(this.arrowDefs && link.startArrow) this.stagedWires[id].setAttribute('marker-start','url(#arrow)') this.stagedWires[id].classList.add('bzgf-wire') this.stagedWires[id].dataset.id = id this.wiresContainer.append(this.stagedWires[id]) return(this.stagedWires[id]) } + + clear(){ + this.nodesContainer.innerHTML = '' + this.wiresContainer.innerHTML = '' + if(this.arrowDefs) this.wiresContainer.appendChild(this.arrowDefs) + } + refresh(){ + this.clear() let forceAutoplace = false for(const node of this.flow.nodes){ if((!node.coords) || (!node.coords.x) ||(!node.coords.y)) forceAutoplace=true @@ -145,7 +155,6 @@ class BZgraflow extends Buildoz{ } bezier(idNode1, idPort1, idNode2, idPort2, tensionMin=60) { - const svgRect = this.wiresContainer.getBoundingClientRect() const node1 = this.stagedNodes[idNode1] const port1 = node1.ports[idPort1] @@ -175,7 +184,7 @@ class BZgraflow extends Buildoz{ let c1y = y1 + (dirVect[port1.direction].y * tension) let c2x = x2 + (dirVect[port2.direction].x * tension) let c2y = y2 + (dirVect[port2.direction].y * tension) - if((idNode1==idNode2) && (idPort1==idPort2)){ // Special case of self-loop: correct intermediary points + if((idNode1==idNode2) && (idPort1==idPort2)){ // Special case of self-loop: spread a bit intermediary points if(['n', 's'].includes(port1.direction)) { c1x += tension c2x -= tension