graflow: autoplace attributes & better ICMP example
This commit is contained in:
11
bzGraflow.js
11
bzGraflow.js
@@ -431,7 +431,7 @@ class BZgraflow extends Buildoz{
|
|||||||
if(bb.width > bb.height) this.currentOrientation = 'horizontal'
|
if(bb.width > bb.height) this.currentOrientation = 'horizontal'
|
||||||
else this.currentOrientation = 'vertical'
|
else this.currentOrientation = 'vertical'
|
||||||
}
|
}
|
||||||
if(forceAutoplace) this.autoPlace(this.currentOrientation, 60, 60)
|
if(forceAutoplace) this.autoPlace(this.currentOrientation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert viewport (client) coordinates to this instance's SVG local coordinates.
|
// Convert viewport (client) coordinates to this instance's SVG local coordinates.
|
||||||
@@ -604,7 +604,14 @@ class BZgraflow extends Buildoz{
|
|||||||
return(path)
|
return(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
autoPlace(orientation = 'horizontal', gapx = 80, gapy = 80, tween=500, align='center'){
|
autoPlace(orientation = 'horizontal', gapx = null, gapy = null, tween = null, align = null){
|
||||||
|
if(gapx == null) gapx = parseInt(this.getBZAttribute('gapx')) || 80
|
||||||
|
if(gapy == null) gapy = parseInt(this.getBZAttribute('gapy')) || 80
|
||||||
|
if(tween == null) tween = parseInt(this.getBZAttribute('tween')) || 500
|
||||||
|
if(align == null) align = this.getBZAttribute('align') || 'center'
|
||||||
|
|
||||||
|
console.log('autoPlace', orientation, gapx, gapy, tween, align)
|
||||||
|
|
||||||
this.currentOrientation = orientation
|
this.currentOrientation = orientation
|
||||||
// Cancel any previous autoPlace() animations by bumping a token.
|
// Cancel any previous autoPlace() animations by bumping a token.
|
||||||
// moveNode() checks this token each frame and will no-op if superseded.
|
// moveNode() checks this token each frame and will no-op if superseded.
|
||||||
|
|||||||
Reference in New Issue
Block a user