代码优化:将render类的clearActive函数名称改为clearActiveNodeList

This commit is contained in:
wanglin2
2023-10-13 11:05:34 +08:00
parent c68d629b7a
commit 9360aff6c9
2 changed files with 12 additions and 12 deletions

View File

@@ -361,7 +361,7 @@ class Render {
this.nodeCache = {}
// 重新渲染需要清除激活状态
if (this.reRender) {
this.clearActive()
this.clearActiveNodeList()
}
// 计算布局
this.layout.doLayout(root => {
@@ -405,12 +405,12 @@ class Render {
if (this.activeNodeList.length <= 0) {
return
}
this.clearActive()
this.clearActiveNodeList()
this.mindMap.emit('node_active', null, [])
}
// 清除当前激活的节点
clearActive() {
// 清除当前激活的节点列表
clearActiveNodeList() {
this.activeNodeList.forEach(item => {
this.setNodeActive(item, false)
})
@@ -542,7 +542,7 @@ class Render {
})
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
if (handleMultiNodes || !openEdit) {
this.clearActive()
this.clearActiveNodeList()
}
this.mindMap.render()
}
@@ -579,7 +579,7 @@ class Render {
)
parent.nodeData.children.splice(index + 1, 0, ...newNodeList)
})
this.clearActive()
this.clearActiveNodeList()
this.mindMap.render()
}
@@ -638,7 +638,7 @@ class Render {
})
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
if (handleMultiNodes || !openEdit) {
this.clearActive()
this.clearActiveNodeList()
}
this.mindMap.render()
}
@@ -672,7 +672,7 @@ class Render {
// 插入子节点时自动展开子节点
node.nodeData.data.expand = true
})
this.clearActive()
this.clearActiveNodeList()
this.mindMap.render()
}
@@ -723,7 +723,7 @@ class Render {
})
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
if (handleMultiNodes || !openEdit) {
this.clearActive()
this.clearActiveNodeList()
}
this.mindMap.render()
}
@@ -999,7 +999,7 @@ class Render {
return node.isRoot
})
if (root) {
this.clearActive()
this.clearActiveNodeList()
root.children.forEach(child => {
child.remove()
})

View File

@@ -492,7 +492,7 @@ class Node {
return
}
if (this.nodeData.data.isActive) {
this.renderer.clearActive()
this.renderer.clearActiveNodeList()
}
this.active(e)
this.mindMap.emit('node_contextmenu', e, this)
@@ -509,7 +509,7 @@ class Node {
return
}
this.mindMap.emit('before_node_active', this, this.renderer.activeNodeList)
this.renderer.clearActive()
this.renderer.clearActiveNodeList()
this.mindMap.execCommand('SET_NODE_ACTIVE', this, true)
this.renderer.addActiveNode(this)
this.mindMap.emit('node_active', this, [...this.renderer.activeNodeList])