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