From 8bf876d446e22bd42c3df5020643a275ab540172 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 18 Apr 2023 17:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=97=B6=E6=94=B9=E4=B8=BA=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E5=8F=AA=E8=A6=81=E5=92=8C=E9=80=89=E5=8C=BA=E9=87=8D=E5=8F=A0?= =?UTF-8?q?=E5=B0=B1=E7=AE=97=E8=A2=AB=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/Select.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/simple-mind-map/src/Select.js b/simple-mind-map/src/Select.js index 98a53c0a..a8c847c9 100644 --- a/simple-mind-map/src/Select.js +++ b/simple-mind-map/src/Select.js @@ -17,7 +17,7 @@ class Select { // 绑定事件 bindEvent() { - this.checkInNodes = throttle(this.checkInNodes, 500, this) + this.checkInNodes = throttle(this.checkInNodes, 300, this) this.mindMap.on('mousedown', e => { if (this.mindMap.opt.readonly) { return @@ -146,22 +146,26 @@ class Select { let bottom = (top + height) * scaleY + translateY left = left * scaleX + translateX top = top * scaleY + translateY - if (left >= minx && right <= maxx && top >= miny && bottom <= maxy) { - this.mindMap.batchExecution.push('activeNode' + node.uid, () => { + if ((left >= minx && left <= maxx || + right >= minx && right <= maxx) && + (top >= miny && top <= maxy || + bottom >= miny && bottom <= maxy) + ) { + // this.mindMap.batchExecution.push('activeNode' + node.uid, () => { if (node.nodeData.data.isActive) { return } this.mindMap.renderer.setNodeActive(node, true) this.mindMap.renderer.addActiveNode(node) - }) + // }) } 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) { return } this.mindMap.renderer.setNodeActive(node, false) this.mindMap.renderer.removeActiveNode(node) - }) + // }) } }) }