Graflow: autofit fixes for subflows

This commit is contained in:
STEINNI
2026-04-14 14:10:15 +00:00
parent d25a4b548a
commit 5f8e3865e3
+6 -2
View File
@@ -272,7 +272,6 @@ class BZgraflow extends Buildoz{
})
}
childEl.setAttribute('tension', this.getBZAttribute('tension') || '60')
// Remember which node we "came from" so exitSubflow() can animate back to it.
childEl.dataset.enterNodeId = id
const btnExitSubflow = document.createElement('button')
@@ -1232,9 +1231,14 @@ class BZgraflow extends Buildoz{
const scale = Math.min(sx, sy)*(percent/100) // uniform scale to fit inside parent
const tx = Number.isFinite(left) ? (-left + gapx) : gapx
const ty = Number.isFinite(top) ? (-top + gapy) : gapy
if(!this.isSubflow) {
this.style.transformOrigin = prevTransformOrigin || 'top left'
// First normalize content origin to (0,0), then scale to fit.
this.style.transform = `scale(${scale}) translate(${tx}px, ${ty}px)`
} else {
this.style.transform = `scale(${scale})`
this.style.width = `calc(100% / ${scale})` // means 100% of the parent node DESPITE the scaling
this.style.height = `calc(100% / ${scale})` // means 100% of the parent node DESPITE the scaling
}
}
}
Buildoz.define('graflow', BZgraflow)