graflow: added autoplace align 1st & last
This commit is contained in:
20
bzGraflow.js
20
bzGraflow.js
@@ -396,7 +396,8 @@ class BZgraflow extends Buildoz{
|
|||||||
return(path)
|
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 !
|
// Loops create infinite recursion in dfs for getting parents & adjacency lists: Remove them !
|
||||||
let linksWithoutBackEdges
|
let linksWithoutBackEdges
|
||||||
if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){
|
if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){
|
||||||
@@ -462,7 +463,22 @@ class BZgraflow extends Buildoz{
|
|||||||
let x = gapx
|
let x = gapx
|
||||||
for(const [idx, layer] of layers.entries()){
|
for(const [idx, layer] of layers.entries()){
|
||||||
let wMax = this.getMaxWidth(layer)
|
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){
|
for(const nid of layer){
|
||||||
if(!nid.startsWith('longLinkPlaceHolder_')) {
|
if(!nid.startsWith('longLinkPlaceHolder_')) {
|
||||||
const bb = this.stagedNodes[nid].getBoundingClientRect()
|
const bb = this.stagedNodes[nid].getBoundingClientRect()
|
||||||
|
|||||||
Reference in New Issue
Block a user