diff --git a/bzGraflow.js b/bzGraflow.js index cb1ca5b..c12c17a 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -235,7 +235,7 @@ class BZgraflow extends Buildoz{ const childEl = document.createElement('bz-graflow') childEl.isSubflow = true childEl.currentOrientation = this.currentOrientation - const inheritedAttrs = ['orientation', 'gapx', 'gapy', 'tween', 'align', 'tension', 'wiretype', 'edit'] // ! Not 'isolated' ! + const inheritedAttrs = ['orientation', 'gapx', 'gapy', 'tween', 'align', 'tension', 'wiretype', 'edit', 'autofit'] // ! Not 'isolated' ! for(const attrName of inheritedAttrs){ if(this.hasAttribute(attrName)) childEl.setAttribute(attrName, this.getAttribute(attrName)) } @@ -473,6 +473,13 @@ class BZgraflow extends Buildoz{ } if(forceAutoplace) this.autoPlace(this.currentOrientation, parseInt(this.getBZAttribute('gapx')) || 80, parseInt(this.getBZAttribute('gapy')) || 80) this.fireEvent('refreshed', { }) + if(this.hasAttribute('autofit')){ + const autofitAttr = this.getAttribute('autofit') + const autofitPercent = (autofitAttr !== null && autofitAttr !== '' && !Number.isNaN(parseFloat(autofitAttr))) + ? parseFloat(autofitAttr) + : undefined + this.autofit(autofitPercent) + } } // Convert viewport (client) coordinates to this instance's SVG local coordinates.