corrected vertical autoplace spacing
This commit is contained in:
@@ -193,7 +193,7 @@ class BZgraflow extends Buildoz{
|
|||||||
return `M ${x1} ${y1} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${x2} ${y2}`
|
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
|
let linksWithoutBackEdges
|
||||||
if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){
|
if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){
|
||||||
console.warn('Loop(s) detected... Cannot auto-place !')
|
console.warn('Loop(s) detected... Cannot auto-place !')
|
||||||
@@ -217,10 +217,7 @@ class BZgraflow extends Buildoz{
|
|||||||
parents[to].push(from)
|
parents[to].push(from)
|
||||||
adj[from].push(to)
|
adj[from].push(to)
|
||||||
})
|
})
|
||||||
console.log('===LinksWithoutBackEdges:===>', linksWithoutBackEdges)
|
|
||||||
|
|
||||||
console.log('===Parents:===>', parents)
|
|
||||||
console.log('===Adj:===>', adj)
|
|
||||||
const layers = this.computeLayers(this.flow.nodes, parents)
|
const layers = this.computeLayers(this.flow.nodes, parents)
|
||||||
let maxHeight = 0; let maxWidth = 0
|
let maxHeight = 0; let maxWidth = 0
|
||||||
const layerHeights = []; const layerWidths = [];
|
const layerHeights = []; const layerWidths = [];
|
||||||
@@ -261,11 +258,12 @@ class BZgraflow extends Buildoz{
|
|||||||
let x = ((maxWidth - layerWidths[idx]) / 2) + gapx
|
let x = ((maxWidth - layerWidths[idx]) / 2) + gapx
|
||||||
for(const nid of layer){
|
for(const nid of layer){
|
||||||
const bb = this.stagedNodes[nid].getBoundingClientRect()
|
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)
|
this.moveNode(nid, x, y, tween)
|
||||||
x += gapx + bb.width
|
x += gapx + bb.width
|
||||||
}
|
}
|
||||||
y += hMax + gapy
|
y += hMax + gapy
|
||||||
|
console.log(y, hMax, gapy )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user