Graflow: autofit as atrtibute

This commit is contained in:
STEINNI
2026-04-13 14:14:59 +00:00
parent 733420c90d
commit 0adc966608
+8 -1
View File
@@ -235,7 +235,7 @@ class BZgraflow extends Buildoz{
const childEl = document.createElement('bz-graflow') const childEl = document.createElement('bz-graflow')
childEl.isSubflow = true childEl.isSubflow = true
childEl.currentOrientation = this.currentOrientation 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){ for(const attrName of inheritedAttrs){
if(this.hasAttribute(attrName)) childEl.setAttribute(attrName, this.getAttribute(attrName)) 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) if(forceAutoplace) this.autoPlace(this.currentOrientation, parseInt(this.getBZAttribute('gapx')) || 80, parseInt(this.getBZAttribute('gapy')) || 80)
this.fireEvent('refreshed', { }) 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. // Convert viewport (client) coordinates to this instance's SVG local coordinates.