diff --git a/bzGraflow.js b/bzGraflow.js index 3ceade5..ccca598 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -431,7 +431,7 @@ class BZgraflow extends Buildoz{ if(bb.width > bb.height) this.currentOrientation = 'horizontal' 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. @@ -604,7 +604,14 @@ class BZgraflow extends Buildoz{ 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 // Cancel any previous autoPlace() animations by bumping a token. // moveNode() checks this token each frame and will no-op if superseded.