Fix:修复点击节点也会触发node_dragend事件的问题

This commit is contained in:
wanglin2 2023-12-04 09:51:56 +08:00
parent 0fa731c3a2
commit 79a39f993d

View File

@ -1,4 +1,9 @@
import { bfsWalk, throttle, getTopAncestorsFomNodeList, getNodeIndexInNodeList } from '../utils'
import {
bfsWalk,
throttle,
getTopAncestorsFomNodeList,
getNodeIndexInNodeList
} from '../utils'
import Base from '../layouts/Base'
// 节点拖动插件
@ -108,9 +113,7 @@ class Drag extends Base {
node.endDrag()
})
this.removeCloneNode()
let overlapNodeUid = this.overlapNode
? this.overlapNode.getData('uid')
: ''
let overlapNodeUid = this.overlapNode ? this.overlapNode.getData('uid') : ''
let prevNodeUid = this.prevNode ? this.prevNode.getData('uid') : ''
let nextNodeUid = this.nextNode ? this.nextNode.getData('uid') : ''
// 存在重叠子节点,则移动作为其子节点
@ -162,12 +165,14 @@ class Drag extends Base {
)
this.mindMap.render()
}
if (this.isDragging) {
this.mindMap.emit('node_dragend', {
overlapNodeUid,
prevNodeUid,
nextNodeUid
})
}
this.reset()
this.mindMap.emit('node_dragend', {
overlapNodeUid,
prevNodeUid,
nextNodeUid
})
}
// 拖动中