graflow: rehresh event to fix movenodes
This commit is contained in:
31
bzGraflow.js
31
bzGraflow.js
@@ -84,23 +84,19 @@ class BZgraflow extends Buildoz{
|
||||
this.mainContainer.append(this.wiresContainer)
|
||||
this.mainContainer.append(this.nodesContainer)
|
||||
this.append(this.hostContainer)
|
||||
this.loadFlow(flowUrl).then(() => {
|
||||
if(this.getBZAttribute('edit')){
|
||||
const edit = this.getBZAttribute('edit').split(',')
|
||||
if(edit.includes('nodesmove')){
|
||||
this.nodesMover = new MovingNodes(this, '.bzgf-node')
|
||||
}
|
||||
if(edit.includes('wires')){
|
||||
this.WiresEditor = new EditWires(this, '.bzgf-wire')
|
||||
this.WiresEditor.enableEditWires()
|
||||
//this.WiresEditor.enableMovingNodes('.bzgf-wire')
|
||||
}
|
||||
if(edit.includes('dropnodes')){
|
||||
this.NodesReceiver = new DroppingNodes(this, '.bzgf-node')
|
||||
//this.NodesReceiver.enableDroppingNodes('.bzgf-node')
|
||||
}
|
||||
if(this.getBZAttribute('edit')){
|
||||
const edit = this.getBZAttribute('edit').split(',')
|
||||
if(edit.includes('nodesmove')){
|
||||
this.nodesMover = new MovingNodes(this, '.bzgf-node')
|
||||
}
|
||||
})
|
||||
if(edit.includes('wires')){
|
||||
this.WiresEditor = new EditWires(this, '.bzgf-wire')
|
||||
}
|
||||
if(edit.includes('dropnodes')){
|
||||
this.NodesReceiver = new DroppingNodes(this, '.bzgf-node')
|
||||
}
|
||||
}
|
||||
this.loadFlow(flowUrl)
|
||||
}
|
||||
|
||||
error(msg, err){
|
||||
@@ -772,7 +768,6 @@ class BZgraflow extends Buildoz{
|
||||
const nodeHeight = this.stagedNodes[nid].offsetHeight || bb.height
|
||||
if((align == 'parent') && (nid in parents) && (parents[nid][0] in parentsY)) {
|
||||
y = Math.max(parentsY[parents[nid][0]], y) //TODO handle multiple parents with avg
|
||||
console.log('parent', nid, parents[nid], parentsY[parents[nid][0]])
|
||||
}
|
||||
placedY = y
|
||||
this.moveNode(nid, x, y, orientation, tween, null, token)
|
||||
@@ -1222,7 +1217,6 @@ class MovingNodes{
|
||||
|
||||
pointerDown(e){
|
||||
this.graflow.clearFakeNodes()
|
||||
console.log('=====> interactive element', e.target)
|
||||
|
||||
const node = e.target.closest(this.itemSelector)
|
||||
if(!node) return
|
||||
@@ -1283,6 +1277,7 @@ class EditWires{
|
||||
this.graflow = graflow
|
||||
this.nodesContainer = this.graflow.mainContainer.querySelector('.bzgf-nodes-container')
|
||||
this.state = null
|
||||
this.graflow.addEventListener('refreshed', this.enableEditWires.bind(this))
|
||||
}
|
||||
enableEditWires(){
|
||||
for(const ref in this.graflow.stagedWires ){
|
||||
|
||||
Reference in New Issue
Block a user