From 7471a37220b1256e90da41a6ddee7fe2b132e433 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Thu, 30 Jul 2026 14:05:33 +0000 Subject: [PATCH] graflow autofit back to percent, and get tween from attr tween --- bzGraflow.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bzGraflow.js b/bzGraflow.js index 78bc95c..7585c03 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -511,11 +511,11 @@ class BZgraflow extends Buildoz{ this.fireEvent('refreshed', { }) if(this.hasAttribute('autofit')){ const autofitAttr = this.getAttribute('autofit') - const autofitTween = (autofitAttr !== null && autofitAttr !== '' && !Number.isNaN(parseFloat(autofitAttr))) + const autofitPerc = (autofitAttr !== null && autofitAttr !== '' && !Number.isNaN(parseFloat(autofitAttr))) ? parseFloat(autofitAttr) : undefined - if(this._canRunAutoPlace()) this.autofit(autofitTween) - else this._scheduleLayoutWhenReady(() => this.autofit(autofitTween)) + if(this._canRunAutoPlace()) this.autofit(autofitPerc) + else this._scheduleLayoutWhenReady(() => this.autofit(autofitPerc)) } } const onLayoutComplete = () => { @@ -1332,7 +1332,7 @@ class BZgraflow extends Buildoz{ return(crossLayerLinks) } - autofit(tween = 0, percent=100){ + autofit(percent=100){ const outwidth = Math.max(this.clientWidth, 1) const outheight = Math.max(this.clientHeight, 1) let inwidth = this.nodesContainer.scrollWidth @@ -1347,6 +1347,7 @@ class BZgraflow extends Buildoz{ return } const ratio = Math.min( (outwidth / inwidth), (outheight / inheight) ) * (percent / 100) + const tween = parseInt(this.getBZAttribute('tween')) || 0 if(tween > 0){ const transition = `scale ${tween}ms ease-in-out` this.nodesContainer.style.transition = transition