graflowEditor: fixed gapy bug , graflow: update flow coords after move

This commit is contained in:
STEINNI
2026-03-23 19:45:40 +00:00
parent 0cb4491920
commit 266036a6ec
2 changed files with 8 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ class BZgrafloweditor extends Buildoz{
this.graflow.setAttribute('wiretype', "bezier") this.graflow.setAttribute('wiretype', "bezier")
this.graflow.setAttribute('tension', "30") this.graflow.setAttribute('tension', "30")
this.graflow.setAttribute('gapx', "80") this.graflow.setAttribute('gapx', "80")
this.graflow.setAttribute('gapy', "20") this.graflow.setAttribute('gapy', "80")
this.graflow.addEventListener('bz:graflow:domConnected', this.setupDropZone.bind(this)) this.graflow.addEventListener('bz:graflow:domConnected', this.setupDropZone.bind(this))
this.graflow.append(this.slidePane) this.graflow.append(this.slidePane)
this.mainContainer.append(this.graflow) this.mainContainer.append(this.graflow)

View File

@@ -698,7 +698,6 @@ class BZgraflow extends Buildoz{
if(totWidth>maxWidth) maxWidth = totWidth if(totWidth>maxWidth) maxWidth = totWidth
layerWidths.push(totWidth) layerWidths.push(totWidth)
} }
// If any long-links, create placeholders for skipped layers // If any long-links, create placeholders for skipped layers
this._virtualLinks = new Map() this._virtualLinks = new Map()
@@ -751,6 +750,7 @@ class BZgraflow extends Buildoz{
y = ((maxHeight - layerHeights[idx]) / 2) + gapy y = ((maxHeight - layerHeights[idx]) / 2) + gapy
break break
} }
console.log('======>',gapy, y)
for(const nid of layer){ for(const nid of layer){
let placedY let placedY
if(!nid.startsWith('longLinkPlaceHolder_')) { if(!nid.startsWith('longLinkPlaceHolder_')) {
@@ -974,6 +974,12 @@ class BZgraflow extends Buildoz{
if(p < 1) requestAnimationFrame(frame.bind(this)) if(p < 1) requestAnimationFrame(frame.bind(this))
else{ else{
const flowNode = this.flow?.nodes?.find(n => n.id === nid)
if(flowNode) {
if(!flowNode.coords) flowNode.coords = {}
flowNode.coords.x = x
flowNode.coords.y = y
}
this.fireEvent('nodeMoved', { nid, x, y }) this.fireEvent('nodeMoved', { nid, x, y })
} }
} }