优化-快捷键支持三键

This commit is contained in:
sunyuqiang 2023-06-20 18:30:59 +08:00
parent b6b1c2eb08
commit 1dfb39c2e7

View File

@ -255,7 +255,7 @@ const setConfig = debounce(() => {
watch(state, setConfig);
const changeShortCut = (e, key) => {
const changeShortCutOld = (e, key) => {
if (e.altKey && e.keyCode !== 18) {
const compose = `Option+${keycodes[e.keyCode].toUpperCase()}`;
state.shortCut[key] = compose;
@ -274,6 +274,30 @@ const changeShortCut = (e, key) => {
}
};
const changeShortCut = (e, key) => {
let compose = '';
if (e.ctrlKey && e.keyCode !== 17) {
compose += '+Ctrl';
}
if (e.shiftKey && e.keyCode !== 16) {
compose += '+Shift';
}
if (e.altKey && e.keyCode !== 18) {
compose += '+Option';
}
if (e.metaKey && e.keyCode !== 93) {
compose += '+Command';
}
compose += '+'+keycodes[e.keyCode].toUpperCase();
compose = compose.substring(1)
console.log(compose);
if(e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 93){
state.shortCut[key] = compose;
}else{
//
}
};
const changeGlobalKey = (e, index) => {
let compose;
if (e.altKey && e.keyCode !== 18) {