diff options
Diffstat (limited to 'web/share/js/keypad.js')
-rw-r--r-- | web/share/js/keypad.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/web/share/js/keypad.js b/web/share/js/keypad.js index 90c1e652..797a351e 100644 --- a/web/share/js/keypad.js +++ b/web/share/js/keypad.js @@ -88,13 +88,19 @@ export function Keypad(__keys_parent, __sendKey, __apply_fixes) { for (let dict of [__keys, __modifiers]) { for (let code in dict) { if (__isActive(dict[code][0])) { - self.emit(code, false); + self.emitByCode(code, false); } } } }; - self.emit = function(code, state, apply_fixes=true) { + self.emitByKeyEvent = function(event, state) { + if (!event.repeat) { + self.emitByCode(event.code, state); + } + }; + + self.emitByCode = function(code, state, apply_fixes=true) { if (code in __merged) { if (__fix_win_altgr && apply_fixes) { if (!__fixWinAltgr(code, state)) { @@ -116,7 +122,7 @@ export function Keypad(__keys_parent, __sendKey, __apply_fixes) { for (let code in __keys) { setTimeout(function() { if (__isActive(__keys[code][0])) { - self.emit(code, false, false); + self.emitByCode(code, false, false); } }, 100); } @@ -131,13 +137,13 @@ export function Keypad(__keys_parent, __sendKey, __apply_fixes) { clearTimeout(__altgr_ctrl_timer); __altgr_ctrl_timer = null; if (code !== "AltRight") { - self.emit("ControlLeft", true, false); + self.emitByCode("ControlLeft", true, false); } } if (code === "ControlLeft" && !__isActive(__modifiers["ControlLeft"][0])) { __altgr_ctrl_timer = setTimeout(function() { __altgr_ctrl_timer = null; - self.emit("ControlLeft", true, false); + self.emitByCode("ControlLeft", true, false); }, 50); return false; // Stop handling } @@ -145,7 +151,7 @@ export function Keypad(__keys_parent, __sendKey, __apply_fixes) { if (__altgr_ctrl_timer) { clearTimeout(__altgr_ctrl_timer); __altgr_ctrl_timer = null; - self.emit("ControlLeft", true, false); + self.emitByCode("ControlLeft", true, false); } } return true; // Continue handling |