Compare commits
4 Commits
3e7a82edc2
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c21f7b772 | |||
| 53ed4eea07 | |||
| 605398505a | |||
| 4f728a3514 |
+1
-1
@@ -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 ! */
|
bz-graflow .bzgf-nodes-container > * { /* allow the nodes to be moved ! */
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
bz-graflow .bzgf-nodes-container .bzgf-node{ position:absolute; }
|
bz-graflow .bzgf-nodes-container .bzgf-node{ position:absolute; }
|
||||||
bz-graflow .bzgf-nodes-container .bzgf-fake-node{
|
bz-graflow .bzgf-nodes-container .bzgf-fake-node{
|
||||||
|
|||||||
+31
-3
@@ -30,6 +30,7 @@ class BZgraflow extends Buildoz{
|
|||||||
this.stagedNodes = { }
|
this.stagedNodes = { }
|
||||||
this.stagedWires = { }
|
this.stagedWires = { }
|
||||||
this.arrowDefs = null
|
this.arrowDefs = null
|
||||||
|
this.arrowMarkerId = `arrow-${crypto.randomUUID()}`
|
||||||
this.currentOrientation = null
|
this.currentOrientation = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +99,28 @@ class BZgraflow extends Buildoz{
|
|||||||
else this.initFlow()
|
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){
|
error(msg, err){
|
||||||
this.querySelector('.graflow-error')?.remove()
|
this.querySelector('.graflow-error')?.remove()
|
||||||
const errorEl = document.createElement('div')
|
const errorEl = document.createElement('div')
|
||||||
@@ -162,6 +185,8 @@ class BZgraflow extends Buildoz{
|
|||||||
for(const tpl of doc.querySelectorAll('template')){
|
for(const tpl of doc.querySelectorAll('template')){
|
||||||
if(tpl.id=='svg-arrows'){
|
if(tpl.id=='svg-arrows'){
|
||||||
this.arrowDefs = tpl.querySelector('defs').cloneNode(true)
|
this.arrowDefs = tpl.querySelector('defs').cloneNode(true)
|
||||||
|
const defaultArrow = this.arrowDefs.querySelector('#arrow')
|
||||||
|
if(defaultArrow) defaultArrow.id = this.arrowMarkerId
|
||||||
this.wiresContainer.appendChild(this.arrowDefs)
|
this.wiresContainer.appendChild(this.arrowDefs)
|
||||||
} else {
|
} else {
|
||||||
const rootEl = tpl.content.querySelector('.bzgf-node')
|
const rootEl = tpl.content.querySelector('.bzgf-node')
|
||||||
@@ -227,6 +252,7 @@ class BZgraflow extends Buildoz{
|
|||||||
}
|
}
|
||||||
|
|
||||||
enterSubflow(id){
|
enterSubflow(id){
|
||||||
|
if(this.disabled || this.hasAttribute('disabled')) return
|
||||||
const nodeEl = this.stagedNodes[id]
|
const nodeEl = this.stagedNodes[id]
|
||||||
if(!nodeEl) return
|
if(!nodeEl) return
|
||||||
|
|
||||||
@@ -406,7 +432,9 @@ class BZgraflow extends Buildoz{
|
|||||||
this.hostContainer.style.opacity = '1'
|
this.hostContainer.style.opacity = '1'
|
||||||
this.hostContainer.style.visibility = 'visible'
|
this.hostContainer.style.visibility = 'visible'
|
||||||
childEl.style.willChange = ''
|
childEl.style.willChange = ''
|
||||||
this.fireEvent('subflowExited', { subflow: childEl })
|
this.fireEvent('subflowExited', {
|
||||||
|
component: this
|
||||||
|
})
|
||||||
}, { once:true })
|
}, { once:true })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,8 +466,8 @@ class BZgraflow extends Buildoz{
|
|||||||
this.stagedWires[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
this.stagedWires[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
||||||
this.stagedWires[id].setAttribute('d', path)
|
this.stagedWires[id].setAttribute('d', path)
|
||||||
this.stagedWires[id].setAttribute('fill', 'none')
|
this.stagedWires[id].setAttribute('fill', 'none')
|
||||||
if(this.arrowDefs && link.endArrow) this.stagedWires[id].setAttribute('marker-end','url(#arrow)')
|
if(this.arrowDefs && link.endArrow) this.stagedWires[id].setAttribute('marker-end',`url(#${this.arrowMarkerId})`)
|
||||||
if(this.arrowDefs && link.startArrow) this.stagedWires[id].setAttribute('marker-start','url(#arrow)')
|
if(this.arrowDefs && link.startArrow) this.stagedWires[id].setAttribute('marker-start',`url(#${this.arrowMarkerId})`)
|
||||||
this.stagedWires[id].classList.add('bzgf-wire')
|
this.stagedWires[id].classList.add('bzgf-wire')
|
||||||
this.stagedWires[id].dataset.id = id
|
this.stagedWires[id].dataset.id = id
|
||||||
this.stagedWires[id].link = link
|
this.stagedWires[id].link = link
|
||||||
|
|||||||
Reference in New Issue
Block a user