Fix:修改派发节点激活事件的逻辑,去除不必要的判断,避免激活节点没有改变的情况下也会触发事件
This commit is contained in:
parent
1510f7a135
commit
29695d1d7e
@ -102,7 +102,6 @@ class Render {
|
|||||||
this.highlightBoxNode = null
|
this.highlightBoxNode = null
|
||||||
this.highlightBoxNodeStyle = null
|
this.highlightBoxNodeStyle = null
|
||||||
// 上一次节点激活数据
|
// 上一次节点激活数据
|
||||||
this.lastActiveNode = null
|
|
||||||
this.lastActiveNodeList = []
|
this.lastActiveNodeList = []
|
||||||
// 布局
|
// 布局
|
||||||
this.setLayout()
|
this.setLayout()
|
||||||
@ -435,13 +434,11 @@ class Render {
|
|||||||
|
|
||||||
// 派发节点激活事件
|
// 派发节点激活事件
|
||||||
emitNodeActiveEvent(node = null, activeNodeList = [...this.activeNodeList]) {
|
emitNodeActiveEvent(node = null, activeNodeList = [...this.activeNodeList]) {
|
||||||
let isChange = false
|
const isChange = !checkNodeListIsEqual(
|
||||||
isChange = this.lastActiveNode !== node
|
this.lastActiveNodeList,
|
||||||
if (!isChange) {
|
activeNodeList
|
||||||
isChange = !checkNodeListIsEqual(this.lastActiveNodeList, activeNodeList)
|
)
|
||||||
}
|
|
||||||
if (!isChange) return
|
if (!isChange) return
|
||||||
this.lastActiveNode = node
|
|
||||||
this.lastActiveNodeList = [...activeNodeList]
|
this.lastActiveNodeList = [...activeNodeList]
|
||||||
this.mindMap.batchExecution.push('emitNodeActiveEvent', () => {
|
this.mindMap.batchExecution.push('emitNodeActiveEvent', () => {
|
||||||
this.mindMap.emit('node_active', node, activeNodeList)
|
this.mindMap.emit('node_active', node, activeNodeList)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user