From 83a5ef8e2ebb2f08d78551f2399a27e07be5d9f3 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 6 Oct 2023 14:08:45 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=E4=BF=AE=E5=A4=8D=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=97=B6=E5=9C=A8=E8=8A=82=E7=82=B9=E4=B8=8A?= =?UTF-8?q?=E6=9D=BE=E5=BC=80=E9=BC=A0=E6=A0=87=E6=97=B6=E6=A1=86=E9=80=89?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E4=B8=8D=E4=BC=9A=E6=B6=88=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/Select.js | 39 +++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/simple-mind-map/src/plugins/Select.js b/simple-mind-map/src/plugins/Select.js index d639202a..bf5c0173 100644 --- a/simple-mind-map/src/plugins/Select.js +++ b/simple-mind-map/src/plugins/Select.js @@ -89,23 +89,28 @@ class Select { } ) }) - this.mindMap.on('mouseup', () => { - if (this.mindMap.opt.readonly) { - return - } - if (!this.isMousedown) { - return - } - this.checkTriggerNodeActiveEvent() - clearTimeout(this.autoMoveTimer) - this.isMousedown = false - this.cacheActiveList = [] - if (this.rect) this.rect.remove() - this.rect = null - setTimeout(() => { - this.isSelecting = false - }, 0) - }) + this.onMouseup = this.onMouseup.bind(this) + this.mindMap.on('mouseup', this.onMouseup) + this.mindMap.on('node_mouseup', this.onMouseup) + } + + // 结束框选 + onMouseup() { + if (this.mindMap.opt.readonly) { + return + } + if (!this.isMousedown) { + return + } + this.checkTriggerNodeActiveEvent() + clearTimeout(this.autoMoveTimer) + this.isMousedown = false + this.cacheActiveList = [] + if (this.rect) this.rect.remove() + this.rect = null + setTimeout(() => { + this.isSelecting = false + }, 0) } // 如果激活节点改变了,那么触发事件