From 90f45c2c8d8fde39b1ad9407f97f8b4893286234 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Fri, 10 Apr 2026 12:49:39 +0000 Subject: [PATCH 1/2] graflow: orientation as param --- bzGraflow.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bzGraflow.js b/bzGraflow.js index 3682346..d29acbe 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -264,7 +264,7 @@ class BZgraflow extends Buildoz{ } } - childEl.autoPlace(this.currentOrientation, 60, 60) + childEl.autoPlace(this.currentOrientation, parseInt(this.getBZAttribute('gapx')) || 80, parseInt(this.getBZAttribute('gapy')) || 80) }, { once:true }) // Fade out the current (host) graflow while the child scales up @@ -442,11 +442,16 @@ class BZgraflow extends Buildoz{ this.addWire(link) } if(!this.currentOrientation) { - const bb=this.getBoundingClientRect() - if(bb.width > bb.height) this.currentOrientation = 'horizontal' - else this.currentOrientation = 'vertical' + if(this.getBZAttribute('orientation')) { + this.currentOrientation = this.getBZAttribute('orientation') + } else { + const bb=this.getBoundingClientRect() + if(bb.width > bb.height) this.currentOrientation = 'horizontal' + else this.currentOrientation = 'vertical' + } } - if(forceAutoplace) this.autoPlace(this.currentOrientation) + console.log('forceAutoplace', forceAutoplace, this.currentOrientation) + if(forceAutoplace) this.autoPlace(this.currentOrientation, parseInt(this.getBZAttribute('gapx')) || 80, parseInt(this.getBZAttribute('gapy')) || 80) this.fireEvent('refreshed', { }) } From 511562c502a868452a6672379944ddac131bb785 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Fri, 10 Apr 2026 13:31:39 +0000 Subject: [PATCH 2/2] graflow: loadNodes is triple modes now: url, blob or object --- bzGraflow.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bzGraflow.js b/bzGraflow.js index d29acbe..665faeb 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -109,24 +109,32 @@ class BZgraflow extends Buildoz{ } async loadFlow(source){ - let buf + let buf, flowObj if(source instanceof Blob){ buf = await source.text() - } else { + try{ + flowObj = JSON.parse(buf) + } catch(err){ + this.error('Could not parse flow JSON!?', err) + return + } + } else if(typeof source == 'string') { const url = source const fetchUrl = (typeof url === 'string' && !url.startsWith('blob:') && !url.startsWith('data:')) ? (url + '?' + crypto.randomUUID()) : url const res = await fetch(fetchUrl) buf = await res.text() + try{ + flowObj = JSON.parse(buf) + } catch(err){ + this.error('Could not parse flow JSON!?', err) + return + } + } else if(typeof source == 'object') { + flowObj = source } - let flowObj - try{ - flowObj = JSON.parse(buf) - } catch(err){ - this.error('Could not parse flow JSON!?', err) - return - } + if(!flowObj.nodesFile){ this.error('No nodesFile in JSON!?') return @@ -450,7 +458,6 @@ class BZgraflow extends Buildoz{ else this.currentOrientation = 'vertical' } } - console.log('forceAutoplace', forceAutoplace, this.currentOrientation) if(forceAutoplace) this.autoPlace(this.currentOrientation, parseInt(this.getBZAttribute('gapx')) || 80, parseInt(this.getBZAttribute('gapy')) || 80) this.fireEvent('refreshed', { }) }