fix: MAC平台,在大屏编辑界面按shift键后,无法使用command键选择图层进行组合

This commit is contained in:
wangjiahao 2023-12-27 18:41:45 +08:00
parent aacdcd26bf
commit c61b7fcf6e
2 changed files with 13 additions and 5 deletions

View File

@ -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) {

View File

@ -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)
}
}