From c1217f153299b663e2e790e0c223c564914c9a8f Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sat, 13 Apr 2024 15:28:56 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=E6=94=AF=E6=8C=81=E6=8C=89=E4=BD=8FComman?= =?UTF-8?q?d=E9=94=AE=E5=92=8CWin=E9=94=AE=E5=A4=9A=E9=80=89=E8=8A=82?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 9 ++++++--- simple-mind-map/src/core/view/View.js | 8 ++++++-- simple-mind-map/src/plugins/Select.js | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index 8a1cad17..eaec8d8d 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -272,7 +272,10 @@ class Node { // 附件 if (this._attachmentData) { textContentWidth += this._attachmentData.width - textContentHeight = Math.max(textContentHeight, this._attachmentData.height) + textContentHeight = Math.max( + textContentHeight, + this._attachmentData.height + ) } // 文字内容部分的尺寸 this._rectInfo.textContentWidth = textContentWidth @@ -466,7 +469,7 @@ class Node { } } // 多选和取消多选 - if (e.ctrlKey && enableCtrlKeyNodeSelection) { + if ((e.ctrlKey || e.metaKey) && enableCtrlKeyNodeSelection) { this.isMultipleChoice = true let isActive = this.getData('isActive') if (!isActive) @@ -510,7 +513,7 @@ class Node { // 双击事件 this.group.on('dblclick', e => { const { readonly, onlyOneEnableActiveNodeOnCooperate } = this.mindMap.opt - if (readonly || e.ctrlKey) { + if (readonly || e.ctrlKey || e.metaKey) { return } e.stopPropagation() diff --git a/simple-mind-map/src/core/view/View.js b/simple-mind-map/src/core/view/View.js index 41ee92ba..1394f570 100644 --- a/simple-mind-map/src/core/view/View.js +++ b/simple-mind-map/src/core/view/View.js @@ -37,7 +37,7 @@ class View { this.mindMap.event.on('drag', (e, event) => { // 按住ctrl键拖动为多选 // 禁用拖拽 - if (e.ctrlKey || this.mindMap.opt.isDisableDrag) { + if (e.ctrlKey || e.metaKey || this.mindMap.opt.isDisableDrag) { return } if (this.firstDrag) { @@ -72,7 +72,11 @@ class View { return customHandleMousewheel(e) } // 1.鼠标滚轮事件控制缩放 - if (mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.ZOOM || e.ctrlKey) { + if ( + mousewheelAction === CONSTANTS.MOUSE_WHEEL_ACTION.ZOOM || + e.ctrlKey || + e.metaKey + ) { if (disableMouseWheelZoom) return const { x: clientX, y: clientY } = this.mindMap.toPos( e.clientX, diff --git a/simple-mind-map/src/plugins/Select.js b/simple-mind-map/src/plugins/Select.js index b66a9d78..b4623c7e 100644 --- a/simple-mind-map/src/plugins/Select.js +++ b/simple-mind-map/src/plugins/Select.js @@ -44,7 +44,7 @@ class Select { } let { useLeftKeySelectionRightKeyDrag } = this.mindMap.opt if ( - !e.ctrlKey && + !(e.ctrlKey || e.metaKey) && (useLeftKeySelectionRightKeyDrag ? e.which !== 1 : e.which !== 3) ) { return