Fix:修复节点处于编辑状态时,通过鼠标滚动移动画布后编辑框和节点脱离的问题

This commit is contained in:
wanglin2
2023-12-01 09:59:33 +08:00
parent 790662ad0c
commit 34eece8fcf

View File

@@ -5,7 +5,7 @@ import {
selectAllInput,
htmlEscape
} from '../../utils'
import { ERROR_TYPES } from '../../constants/constant'
import { ERROR_TYPES, CONSTANTS } from '../../constants/constant'
// 节点文字编辑类
export default class TextEdit {
@@ -54,6 +54,12 @@ export default class TextEdit {
this.mindMap.on('before_node_active', () => {
this.hideEditTextBox()
})
// 鼠标滚动事件
this.mindMap.on('mousewheel', () => {
if (this.mindMap.opt.mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.MOVE) {
this.hideEditTextBox()
}
})
// 注册编辑快捷键
this.mindMap.keyCommand.addShortcut('F2', () => {
if (this.renderer.activeNodeList.length <= 0) {