未验证 提交 e5517fa6 编写于 作者: G GitSquared

Synchronise modifiers on physical and virtual kb

Close #440
上级 b00b12cb
......@@ -226,6 +226,13 @@ class Keyboard {
this.keydownHandler = e => {
// See #330
if (e.getModifierState("AltGraph")) return;
// See #440
if (e.code === "ShiftLeft" || e.code === "ShiftRight") this.container.dataset.isShiftOn = true;
if (e.code === "AltLeft" || e.code === "AltRight") this.container.dataset.isAltOn = true;
if (e.code === "CapsLock" && !this.container.dataset.isCapsLckOn) this.container.dataset.isCapsLckOn = true;
if (e.code === "CapsLock" && this.container.dataset.isCapsLckOn) this.container.dataset.isCapsLckOn = false;
let key = findKey(e);
if (key === null) return;
if (key.length) {
......@@ -243,6 +250,11 @@ class Keyboard {
document.onkeyup = e => {
// See #330
if (e.key !== "AltGraph" && e.getModifierState("AltGraph")) return;
// See #440
if (e.code === "ShiftLeft" || e.code === "ShiftRight") this.container.dataset.isShiftOn = false;
if (e.code === "AltLeft" || e.code === "AltRight") this.container.dataset.isAltOn = false;
let key = findKey(e);
if (key === null) return;
if (key.length) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册