From 6cee95ff0eb4edd22aa94f94e3fe6d72f5a97ef9 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Sat, 21 Feb 2026 22:24:10 +0000 Subject: [PATCH] graflow: added autoplace align 1st & last --- bzGraflow.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/bzGraflow.js b/bzGraflow.js index b6ff894..19d16ad 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -396,7 +396,8 @@ class BZgraflow extends Buildoz{ return(path) } - autoPlace(orientation = 'horizontal', gapx = 80, gapy = 80, tween=1000){ + autoPlace(orientation = 'horizontal', gapx = 80, gapy = 80, tween=1000, align='center'){ + console.log('autoPlace', orientation, gapx, gapy, tween, align) // Loops create infinite recursion in dfs for getting parents & adjacency lists: Remove them ! let linksWithoutBackEdges if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){ @@ -462,7 +463,22 @@ class BZgraflow extends Buildoz{ let x = gapx for(const [idx, layer] of layers.entries()){ let wMax = this.getMaxWidth(layer) - let y = ((maxHeight - layerHeights[idx]) / 2) + gapy + let y = 0 + switch(align){ + case'center': + y = ((maxHeight - layerHeights[idx]) / 2) + gapy + break + case'first': + y = gapy + break + case'last': + y = maxHeight - layerHeights[idx] + gapy + break + case 'auto': + //TODO + y = ((maxHeight - layerHeights[idx]) / 2) + gapy + break + } for(const nid of layer){ if(!nid.startsWith('longLinkPlaceHolder_')) { const bb = this.stagedNodes[nid].getBoundingClientRect()