|
|
@ -18,8 +18,6 @@ window.onkeydown = function (e) { |
|
|
|
// console.log(key);
|
|
|
|
// console.log(key);
|
|
|
|
|
|
|
|
|
|
|
|
if (listeners == null || listeners.length === 0) return; |
|
|
|
if (listeners == null || listeners.length === 0) return; |
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 异或操作.
|
|
|
|
// 异或操作.
|
|
|
|
const xor = (a: boolean, b: boolean) => a !== b; |
|
|
|
const xor = (a: boolean, b: boolean) => a !== b; |
|
|
@ -30,6 +28,8 @@ window.onkeydown = function (e) { |
|
|
|
if (xor(shift, e.shiftKey)) return; |
|
|
|
if (xor(shift, e.shiftKey)) return; |
|
|
|
if (xor(alt, e.altKey)) return; |
|
|
|
if (xor(alt, e.altKey)) return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
callback(); |
|
|
|
callback(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|