mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 18:37:43 +08:00
代码优化:通过addNodeToActiveList方法优化render类中的重复逻辑
This commit is contained in:
parent
87eccc298c
commit
22b56fb8dc
@ -1002,9 +1002,7 @@ class Render {
|
||||
this.activeNodeList = []
|
||||
// 激活被删除节点的兄弟节点或父节点
|
||||
if (needActiveNode) {
|
||||
this.activeNodeList.push(needActiveNode)
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', needActiveNode, true)
|
||||
needActiveNode = null
|
||||
this.addNodeToActiveList(needActiveNode)
|
||||
}
|
||||
this.mindMap.emit('node_active', null, [...this.activeNodeList])
|
||||
this.mindMap.render()
|
||||
@ -1048,9 +1046,7 @@ class Render {
|
||||
this.activeNodeList = []
|
||||
// 激活被删除节点的兄弟节点或父节点
|
||||
if (needActiveNode) {
|
||||
this.activeNodeList.push(needActiveNode)
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', needActiveNode, true)
|
||||
needActiveNode = null
|
||||
this.addNodeToActiveList(needActiveNode)
|
||||
}
|
||||
this.mindMap.emit('node_active', null, [...this.activeNodeList])
|
||||
this.mindMap.render()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user