From 26ec138084655bb1cc67d3a4dcf82a53d77b7b2f Mon Sep 17 00:00:00 2001 From: STEINNI Date: Wed, 14 Jan 2026 19:57:50 +0000 Subject: [PATCH] corrected vertical autoplace spacing --- app/assets/html/bzGraflow/nodesTest2.html | 10 +++++----- app/assets/html/test.html | 4 ++-- app/thirdparty/buildoz/bzGraflow.js | 8 +++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/assets/html/bzGraflow/nodesTest2.html b/app/assets/html/bzGraflow/nodesTest2.html index 57b4977..933b3b4 100644 --- a/app/assets/html/bzGraflow/nodesTest2.html +++ b/app/assets/html/bzGraflow/nodesTest2.html @@ -56,14 +56,14 @@ } .bzgf-node[data-nodetype="condition"] .frame{ border: 1px solid white; - transform: rotate(-45deg); + transform: rotate(-45deg) scale(0.7071); position: absolute; inset: 0; } - .bzgf-node[data-nodetype="condition"] .port[data-direction="w"]{ left: -28px; } - .bzgf-node[data-nodetype="condition"] [data-direction="e"]{ right: -28px; } - .bzgf-node[data-nodetype="condition"] [data-direction="n"]{ top: -28px; } - .bzgf-node[data-nodetype="condition"] [data-direction="s"]{ bottom: -28px; } + .bzgf-node[data-nodetype="condition"] .port[data-direction="w"]{ left: -5px; } + .bzgf-node[data-nodetype="condition"] [data-direction="e"]{ right: -5px; } + .bzgf-node[data-nodetype="condition"] [data-direction="n"]{ top: -5px; } + .bzgf-node[data-nodetype="condition"] [data-direction="s"]{ bottom: -5px; } .bzgf-node[data-nodetype="process"]{ border: 1px solid white; diff --git a/app/assets/html/test.html b/app/assets/html/test.html index 7721b96..84d0570 100644 --- a/app/assets/html/test.html +++ b/app/assets/html/test.html @@ -42,7 +42,7 @@ window.addEventListener('load',()=>{ const grflw1 = document.querySelector('bz-graflow.compunet') document.querySelector('[data-trigger="onAutoplace1H"]').addEventListener('click', - (evt) => { grflw1.autoPlace('horizontal') } + (evt) => { grflw1.autoPlace('horizontal', 80, 30, 1000) } ) document.querySelector('[data-trigger="onAutoplace1V"]').addEventListener('click', (evt) => { grflw1.autoPlace('vertical') } @@ -61,7 +61,7 @@ (evt) => { grflw3.autoPlace('horizontal', 80, 80, 1000) } ) document.querySelector('[data-trigger="onAutoplace3V"]').addEventListener('click', - (evt) => { grflw3.autoPlace('vertical', 80, 80, 1000) } + (evt) => { grflw3.autoPlace('vertical', 80, 50, 1000) } ) }) diff --git a/app/thirdparty/buildoz/bzGraflow.js b/app/thirdparty/buildoz/bzGraflow.js index a6ccc80..a7ea5ce 100644 --- a/app/thirdparty/buildoz/bzGraflow.js +++ b/app/thirdparty/buildoz/bzGraflow.js @@ -193,7 +193,7 @@ class BZgraflow extends Buildoz{ return `M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}` } - autoPlace(orientation = 'horizontal', gapx = 80, gapy = 30, tween=1000){ + autoPlace(orientation = 'horizontal', gapx = 80, gapy = 80, tween=1000){ let linksWithoutBackEdges if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){ console.warn('Loop(s) detected... Cannot auto-place !') @@ -217,10 +217,7 @@ class BZgraflow extends Buildoz{ parents[to].push(from) adj[from].push(to) }) - console.log('===LinksWithoutBackEdges:===>', linksWithoutBackEdges) - console.log('===Parents:===>', parents) - console.log('===Adj:===>', adj) const layers = this.computeLayers(this.flow.nodes, parents) let maxHeight = 0; let maxWidth = 0 const layerHeights = []; const layerWidths = []; @@ -261,11 +258,12 @@ class BZgraflow extends Buildoz{ let x = ((maxWidth - layerWidths[idx]) / 2) + gapx for(const nid of layer){ const bb = this.stagedNodes[nid].getBoundingClientRect() - hMax = (bb.height > hMax) ? bb.width : hMax + hMax = (bb.height > hMax) ? bb.height : hMax this.moveNode(nid, x, y, tween) x += gapx + bb.width } y += hMax + gapy + console.log(y, hMax, gapy ) } } }