代码优化:将render类的clearActive函数名称改为clearActiveNodeList
This commit is contained in:
parent
c68d629b7a
commit
9360aff6c9
@ -361,7 +361,7 @@ class Render {
|
|||||||
this.nodeCache = {}
|
this.nodeCache = {}
|
||||||
// 重新渲染需要清除激活状态
|
// 重新渲染需要清除激活状态
|
||||||
if (this.reRender) {
|
if (this.reRender) {
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
}
|
}
|
||||||
// 计算布局
|
// 计算布局
|
||||||
this.layout.doLayout(root => {
|
this.layout.doLayout(root => {
|
||||||
@ -405,12 +405,12 @@ class Render {
|
|||||||
if (this.activeNodeList.length <= 0) {
|
if (this.activeNodeList.length <= 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
this.mindMap.emit('node_active', null, [])
|
this.mindMap.emit('node_active', null, [])
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除当前激活的节点
|
// 清除当前激活的节点列表
|
||||||
clearActive() {
|
clearActiveNodeList() {
|
||||||
this.activeNodeList.forEach(item => {
|
this.activeNodeList.forEach(item => {
|
||||||
this.setNodeActive(item, false)
|
this.setNodeActive(item, false)
|
||||||
})
|
})
|
||||||
@ -542,7 +542,7 @@ class Render {
|
|||||||
})
|
})
|
||||||
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
|
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
|
||||||
if (handleMultiNodes || !openEdit) {
|
if (handleMultiNodes || !openEdit) {
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
}
|
}
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ class Render {
|
|||||||
)
|
)
|
||||||
parent.nodeData.children.splice(index + 1, 0, ...newNodeList)
|
parent.nodeData.children.splice(index + 1, 0, ...newNodeList)
|
||||||
})
|
})
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ class Render {
|
|||||||
})
|
})
|
||||||
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
|
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
|
||||||
if (handleMultiNodes || !openEdit) {
|
if (handleMultiNodes || !openEdit) {
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
}
|
}
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
}
|
}
|
||||||
@ -672,7 +672,7 @@ class Render {
|
|||||||
// 插入子节点时自动展开子节点
|
// 插入子节点时自动展开子节点
|
||||||
node.nodeData.data.expand = true
|
node.nodeData.data.expand = true
|
||||||
})
|
})
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ class Render {
|
|||||||
})
|
})
|
||||||
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
|
// 如果同时对多个节点插入子节点,需要清除原来激活的节点
|
||||||
if (handleMultiNodes || !openEdit) {
|
if (handleMultiNodes || !openEdit) {
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
}
|
}
|
||||||
this.mindMap.render()
|
this.mindMap.render()
|
||||||
}
|
}
|
||||||
@ -999,7 +999,7 @@ class Render {
|
|||||||
return node.isRoot
|
return node.isRoot
|
||||||
})
|
})
|
||||||
if (root) {
|
if (root) {
|
||||||
this.clearActive()
|
this.clearActiveNodeList()
|
||||||
root.children.forEach(child => {
|
root.children.forEach(child => {
|
||||||
child.remove()
|
child.remove()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -492,7 +492,7 @@ class Node {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.nodeData.data.isActive) {
|
if (this.nodeData.data.isActive) {
|
||||||
this.renderer.clearActive()
|
this.renderer.clearActiveNodeList()
|
||||||
}
|
}
|
||||||
this.active(e)
|
this.active(e)
|
||||||
this.mindMap.emit('node_contextmenu', e, this)
|
this.mindMap.emit('node_contextmenu', e, this)
|
||||||
@ -509,7 +509,7 @@ class Node {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.mindMap.emit('before_node_active', this, this.renderer.activeNodeList)
|
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.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])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user