修复首次打开画布无法加载节点问题

This commit is contained in:
X1627315083@163.com
2026-03-24 10:53:41 +08:00
parent 54f786e94b
commit f8f760119c
2 changed files with 8 additions and 4 deletions

View File

@@ -54,6 +54,7 @@ export class NodeManager {
return current.data.createIndexPosition > max.data.createIndexPosition ? current : max return current.data.createIndexPosition > max.data.createIndexPosition ? current : max
}, superiorGenerateNodes[0]) }, superiorGenerateNodes[0])
const snode = superiorID ? this.stateManager.flowManager.getNodeById(superiorID) : this.stateManager.flowManager.getLastNode(); const snode = superiorID ? this.stateManager.flowManager.getNodeById(superiorID) : this.stateManager.flowManager.getLastNode();
console.log(snode)
const id = options.id || createId() const id = options.id || createId()
const positionX = options.positionX || 0 const positionX = options.positionX || 0
const positionY = options.positionY || 0 const positionY = options.positionY || 0
@@ -65,10 +66,14 @@ export class NodeManager {
{ {
x: endGenerateNode.position.x + positionX, x: endGenerateNode.position.x + positionX,
y: endGenerateNode.position.y + positionY + this.ranksep + 200 y: endGenerateNode.position.y + positionY + this.ranksep + 200
} : } : snode ?
{ {
x: snode.position.x + snode.dimensions.width + this.nodesep + positionX, x: snode.position.x + snode.dimensions.width + this.nodesep + positionX,
y: snode.position.y + positionY y: snode.position.y + positionY
} :
{
x: positionX,
y: positionY
} }
) )
const data = options?.data || {} const data = options?.data || {}

View File

@@ -226,10 +226,9 @@ defineExpose({push})
margin-bottom: 2rem; margin-bottom: 2rem;
background-color: #ffffff; background-color: #ffffff;
cursor: pointer; cursor: pointer;
pointer-events: none; display: none;
&.active{ &.active{
pointer-events: auto; display: flex;
display: none;
} }
&:hover{ &:hover{
background-color: #f5f5f5; background-color: #f5f5f5;