Fix:修复开启openRealtimeRenderOnNodeTextEdit选项后非富文本模式编辑文本时输入框会左右抖动的问题

This commit is contained in:
街角小林
2024-10-17 09:13:55 +08:00
parent a0f88031c1
commit 34d7c6fed2
2 changed files with 6 additions and 3 deletions

View File

@@ -157,7 +157,8 @@ class Render {
node.height = height
node.layout()
this.mindMap.render(() => {
this.textEdit.updateTextEditNode()
// 输入框的left不会改变所以无需更新
this.textEdit.updateTextEditNode(['left'])
})
})
}

View File

@@ -308,7 +308,8 @@ export default class TextEdit {
}
// 更新文本编辑框的大小和位置
updateTextEditNode() {
// notChangeProps不会发生改变的属性列表
updateTextEditNode(notChangeProps = []) {
if (this.mindMap.richText) {
this.mindMap.richText.updateTextEditNode()
return
@@ -321,7 +322,8 @@ export default class TextEdit {
rect.width + this.textNodePaddingX * 2 + 'px'
this.textEditNode.style.minHeight =
rect.height + this.textNodePaddingY * 2 + 'px'
this.textEditNode.style.left = rect.left + 'px'
if (!notChangeProps.includes('left'))
this.textEditNode.style.left = rect.left + 'px'
this.textEditNode.style.top = rect.top + 'px'
}