Feat:node_active事件抛出的激活节点列表不再直接引用内部激活列表

This commit is contained in:
wanglin2 2023-09-01 09:45:17 +08:00
parent a404a71ba2
commit 4c3f3cb1ab
3 changed files with 7 additions and 7 deletions

View File

@ -342,7 +342,7 @@ class Render {
} }
}) })
}) })
this.mindMap.emit('node_active', null, this.activeNodeList) this.mindMap.emit('node_active', null, [...this.activeNodeList])
} }
// 清除当前激活的节点 // 清除当前激活的节点
@ -854,7 +854,7 @@ class Render {
} }
} }
} }
this.mindMap.emit('node_active', null, this.activeNodeList) this.mindMap.emit('node_active', null, [...this.activeNodeList])
this.mindMap.render() this.mindMap.render()
} }
@ -886,7 +886,7 @@ class Render {
let copyData = copyNodeTree({}, node, true) let copyData = copyNodeTree({}, node, true)
this.removeActiveNode(node) this.removeActiveNode(node)
this.removeOneNode(node) this.removeOneNode(node)
this.mindMap.emit('node_active', null, this.activeNodeList) this.mindMap.emit('node_active', null, [...this.activeNodeList])
this.mindMap.render() this.mindMap.render()
if (callback && typeof callback === 'function') { if (callback && typeof callback === 'function') {
callback(copyData) callback(copyData)
@ -901,7 +901,7 @@ class Render {
// let copyData = copyNodeTree({}, node, false, true) // let copyData = copyNodeTree({}, node, false, true)
this.removeActiveNode(node) this.removeActiveNode(node)
this.removeOneNode(node) this.removeOneNode(node)
this.mindMap.emit('node_active', null, this.activeNodeList) this.mindMap.emit('node_active', null, [...this.activeNodeList])
toNode.nodeData.children.push(node.nodeData) toNode.nodeData.children.push(node.nodeData)
this.mindMap.render() this.mindMap.render()
if (toNode.isRoot) { if (toNode.isRoot) {

View File

@ -417,7 +417,7 @@ class Node {
this.mindMap.emit( this.mindMap.emit(
'node_active', 'node_active',
isActive ? null : this, isActive ? null : this,
this.mindMap.renderer.activeNodeList [...this.mindMap.renderer.activeNodeList]
) )
} }
this.mindMap.emit('node_mousedown', this, e) this.mindMap.emit('node_mousedown', this, e)
@ -481,7 +481,7 @@ class Node {
this.renderer.clearActive() this.renderer.clearActive()
this.mindMap.execCommand('SET_NODE_ACTIVE', this, true) this.mindMap.execCommand('SET_NODE_ACTIVE', this, true)
this.renderer.addActiveNode(this) this.renderer.addActiveNode(this)
this.mindMap.emit('node_active', this, this.renderer.activeNodeList) this.mindMap.emit('node_active', this, [...this.renderer.activeNodeList])
} }
// 更新节点 // 更新节点

View File

@ -95,7 +95,7 @@ class Select {
this.mindMap.emit( this.mindMap.emit(
'node_active', 'node_active',
null, null,
this.mindMap.renderer.activeNodeList [...this.mindMap.renderer.activeNodeList]
) )
} }
} }