From c61b7fcf6ef9544c528c0cee5cd054efa10c533e Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 27 Dec 2023 18:41:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20MAC=E5=B9=B3=E5=8F=B0=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E7=BC=96=E8=BE=91=E7=95=8C=E9=9D=A2=E6=8C=89?= =?UTF-8?q?shift=E9=94=AE=E5=90=8E=EF=BC=8C=E6=97=A0=E6=B3=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8command=E9=94=AE=E9=80=89=E6=8B=A9=E5=9B=BE=E5=B1=82?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=BB=84=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/RealTimeListTree.vue | 6 ++++++ core/core-frontend/src/utils/DeShortcutKey.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue b/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue index 654772cc68..e5f2723768 100644 --- a/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue +++ b/core/core-frontend/src/components/data-visualization/RealTimeListTree.vue @@ -65,6 +65,12 @@ const onClick = (e, index) => { composeStore.setLaterIndex(null) } // ctrl or command 按下时 鼠标点击为选择需要组合的组件(取消需要组合的组件在ComposeShow组件中) + console.log( + 'isCtrlOrCmdDown=' + + isCtrlOrCmdDown.value + + ';all=' + + !!(isCtrlOrCmdDown.value && !areaData.value.components.includes(componentData.value[index])) + ) if (isCtrlOrCmdDown.value && !areaData.value.components.includes(componentData.value[index])) { areaDataPush(componentData.value[index]) if (curComponent.value && curComponent.value.id !== componentData.value[index].id) { diff --git a/core/core-frontend/src/utils/DeShortcutKey.ts b/core/core-frontend/src/utils/DeShortcutKey.ts index 19d4611046..665f3bbb26 100644 --- a/core/core-frontend/src/utils/DeShortcutKey.ts +++ b/core/core-frontend/src/utils/DeShortcutKey.ts @@ -109,11 +109,11 @@ export function listenGlobalKeyDown() { } else if (keyCode === shiftKey) { isShiftDown = true composeStore.setIsShiftDownStatus(true) - releaseKeyCheck() + releaseKeyCheck('shift') } else if (keyCode === ctrlKey || keyCode === commandKey) { isCtrlOrCommandDown = true composeStore.setIsCtrlOrCmdDownStatus(true) - releaseKeyCheck() + releaseKeyCheck('ctrl') } else if ((keyCode == deleteKey || keyCode == macDeleteKey) && curComponent.value) { deleteComponent() } else if (isCtrlOrCommandDown) { @@ -125,6 +125,7 @@ export function listenGlobalKeyDown() { lockMap[keyCode]() } } + console.log('1111=isCtrlOrCommandDown' + isCtrlOrCommandDown + ';isShiftDown=' + isShiftDown) } window.onkeyup = e => { @@ -150,11 +151,12 @@ export function releaseAttachKey() { } //当前不支持同时ctrl + shift操作 -function releaseKeyCheck() { - if (isCtrlOrCommandDown && isShiftDown) { +function releaseKeyCheck(keyType) { + if (keyType === 'shift' && isCtrlOrCommandDown) { isCtrlOrCommandDown = false composeStore.setIsCtrlOrCmdDownStatus(false) - isShiftDown = true + } else if (keyType === 'ctrl' && isShiftDown) { + isShiftDown = false composeStore.setIsShiftDownStatus(false) } }