调整画布

This commit is contained in:
lzp
2026-03-05 16:56:03 +08:00
parent 624273e478
commit cdb6bd3065
2 changed files with 17 additions and 5 deletions

View File

@@ -104,6 +104,9 @@ export class StateManager {
}
/** 删除节点 */
async deleteNode(id: string, { isElMessageBox } = { isElMessageBox: false }) {
const node = this.getNodeById(id)
if (!node) return console.warn(`没有找到指定id:${id}`)
if (node.data.disableDelete) return console.warn('该节点禁用删除')
let deletePromise: any = true
if (isElMessageBox) {
deletePromise = await new Promise<void>((resolve, reject) => {
@@ -122,9 +125,6 @@ export class StateManager {
})
}
if (!deletePromise) return console.log('删除操作被取消')
const node = this.getNodeById(id)
if (!node) return console.warn(`没有找到指定id:${id}`)
if (node.data.disableDelete) return console.warn('该节点禁用删除')
this.nodes.value = this.nodes.value.filter((node: NodesItem) => node.id !== id)
this.recordState()
}