mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Fix:1.全选、删除节点激活相邻节点、多选节点等操作增加派发before_node_active事件;2.多选节点改为实时派发激活事件
This commit is contained in:
@@ -520,7 +520,7 @@ class Render {
|
||||
}
|
||||
|
||||
// 添加节点到激活列表里
|
||||
addNodeToActiveList(node) {
|
||||
addNodeToActiveList(node, notEmitBeforeNodeActiveEvent = false) {
|
||||
if (
|
||||
this.mindMap.opt.onlyOneEnableActiveNodeOnCooperate &&
|
||||
node.userList.length > 0
|
||||
@@ -528,6 +528,9 @@ class Render {
|
||||
return
|
||||
const index = this.findActiveNodeIndex(node)
|
||||
if (index === -1) {
|
||||
if (!notEmitBeforeNodeActiveEvent) {
|
||||
this.mindMap.emit('before_node_active', node, this.activeNodeList)
|
||||
}
|
||||
this.mindMap.execCommand('SET_NODE_ACTIVE', node, true)
|
||||
this.activeNodeList.push(node)
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ class Node {
|
||||
)
|
||||
this.mindMap.renderer[
|
||||
isActive ? 'removeNodeFromActiveList' : 'addNodeToActiveList'
|
||||
](this)
|
||||
](this, true)
|
||||
this.renderer.emitNodeActiveEvent(isActive ? null : this)
|
||||
}
|
||||
this.mindMap.emit('node_mousedown', this, e)
|
||||
@@ -563,7 +563,7 @@ class Node {
|
||||
}
|
||||
this.mindMap.emit('before_node_active', this, this.renderer.activeNodeList)
|
||||
this.renderer.clearActiveNodeList()
|
||||
this.renderer.addNodeToActiveList(this)
|
||||
this.renderer.addNodeToActiveList(this, true)
|
||||
this.renderer.emitNodeActiveEvent(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -237,11 +237,13 @@ class Select {
|
||||
return
|
||||
}
|
||||
this.mindMap.renderer.addNodeToActiveList(node)
|
||||
this.mindMap.renderer.emitNodeActiveEvent()
|
||||
} else if (node.getData('isActive')) {
|
||||
if (!node.getData('isActive')) {
|
||||
return
|
||||
}
|
||||
this.mindMap.renderer.removeNodeFromActiveList(node)
|
||||
this.mindMap.renderer.emitNodeActiveEvent()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user