Fix:修复节点处于编辑状态时给节点添加图标等内容时会导致图标和编辑框重叠的问题

This commit is contained in:
街角小林
2024-12-23 18:12:40 +08:00
parent 6479841dee
commit 799b46c68e

View File

@@ -33,6 +33,7 @@ export default class TextEdit {
this.hasBodyMousedown = false
this.textNodePaddingX = 5
this.textNodePaddingY = 3
this.isNeedUpdateTextEditNode = false
this.bindEvent()
}
@@ -124,6 +125,18 @@ export default class TextEdit {
]('keydown', this.onKeydown)
}
})
// 正在编辑文本时,给节点添加了图标等其他内容时需要更新编辑框的位置
this.mindMap.on('afterExecCommand', () => {
if (!this.isShowTextEdit()) return
this.isNeedUpdateTextEditNode = true
})
this.mindMap.on('node_tree_render_end', () => {
if (!this.isShowTextEdit()) return
if (this.isNeedUpdateTextEditNode) {
this.isNeedUpdateTextEditNode = false
this.updateTextEditNode()
}
})
}
// 解绑事件