diff --git a/buildoz.css b/buildoz.css index 367caee..275f81e 100644 --- a/buildoz.css +++ b/buildoz.css @@ -254,7 +254,7 @@ bz-graflow .bzgf-nodes-container{ /* used to keep the nodes container pointer-ev } bz-graflow .bzgf-nodes-container > * { /* allow the nodes to be moved ! */ pointer-events: auto; - } +} bz-graflow .bzgf-nodes-container .bzgf-node{ position:absolute; } bz-graflow .bzgf-nodes-container .bzgf-fake-node{ diff --git a/bzGraflow.js b/bzGraflow.js index ecde514..1aa6cff 100644 --- a/bzGraflow.js +++ b/bzGraflow.js @@ -98,6 +98,28 @@ class BZgraflow extends Buildoz{ else this.initFlow() } + static get observedAttributes(){ + return([...super.observedAttributes, 'disabled']) + } + + attributeChangedCallback(name, oldValue, newValue) { + super.attributeChangedCallback(name, oldValue, newValue) + if(name == 'disabled'){ + if(newValue === null) { + this.disabled = false + this.style.opacity = 1 + this.style.pointerEvents = 'auto' + } else { + this.disabled = true + this.style.opacity = 0.5 + this.style.pointerEvents = 'none' + } + this.querySelectorAll('.bzgf-zoom-in, .bzgf-zoom-out').forEach((btn) => { + btn.disabled = this.disabled + }) + } + } + error(msg, err){ this.querySelector('.graflow-error')?.remove() const errorEl = document.createElement('div') @@ -227,6 +249,7 @@ class BZgraflow extends Buildoz{ } enterSubflow(id){ + if(this.disabled || this.hasAttribute('disabled')) return const nodeEl = this.stagedNodes[id] if(!nodeEl) return