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