优化:多选节点时改为节点只要和选区重叠就算被选中
This commit is contained in:
parent
f2521f663e
commit
8bf876d446
@ -17,7 +17,7 @@ class Select {
|
|||||||
|
|
||||||
// 绑定事件
|
// 绑定事件
|
||||||
bindEvent() {
|
bindEvent() {
|
||||||
this.checkInNodes = throttle(this.checkInNodes, 500, this)
|
this.checkInNodes = throttle(this.checkInNodes, 300, this)
|
||||||
this.mindMap.on('mousedown', e => {
|
this.mindMap.on('mousedown', e => {
|
||||||
if (this.mindMap.opt.readonly) {
|
if (this.mindMap.opt.readonly) {
|
||||||
return
|
return
|
||||||
@ -146,22 +146,26 @@ class Select {
|
|||||||
let bottom = (top + height) * scaleY + translateY
|
let bottom = (top + height) * scaleY + translateY
|
||||||
left = left * scaleX + translateX
|
left = left * scaleX + translateX
|
||||||
top = top * scaleY + translateY
|
top = top * scaleY + translateY
|
||||||
if (left >= minx && right <= maxx && top >= miny && bottom <= maxy) {
|
if ((left >= minx && left <= maxx ||
|
||||||
this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
right >= minx && right <= maxx) &&
|
||||||
|
(top >= miny && top <= maxy ||
|
||||||
|
bottom >= miny && bottom <= maxy)
|
||||||
|
) {
|
||||||
|
// this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
||||||
if (node.nodeData.data.isActive) {
|
if (node.nodeData.data.isActive) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.mindMap.renderer.setNodeActive(node, true)
|
this.mindMap.renderer.setNodeActive(node, true)
|
||||||
this.mindMap.renderer.addActiveNode(node)
|
this.mindMap.renderer.addActiveNode(node)
|
||||||
})
|
// })
|
||||||
} else if (node.nodeData.data.isActive) {
|
} else if (node.nodeData.data.isActive) {
|
||||||
this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
// this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
||||||
if (!node.nodeData.data.isActive) {
|
if (!node.nodeData.data.isActive) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.mindMap.renderer.setNodeActive(node, false)
|
this.mindMap.renderer.setNodeActive(node, false)
|
||||||
this.mindMap.renderer.removeActiveNode(node)
|
this.mindMap.renderer.removeActiveNode(node)
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user