summaryrefslogtreecommitdiff
path: root/web/share/js/keypad.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-03-13 20:01:43 +0300
committerDevaev Maxim <[email protected]>2021-03-13 20:01:43 +0300
commit1c1bb3b2e6fa7431aaad6b05688b5b591ada2617 (patch)
treee9e151a59fefdbddd244be8a87e345f2da18d1b6 /web/share/js/keypad.js
parentde3a14467377d0a33303304b6787b4c4151b0e0c (diff)
better mac cmd handling
Diffstat (limited to 'web/share/js/keypad.js')
-rw-r--r--web/share/js/keypad.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/web/share/js/keypad.js b/web/share/js/keypad.js
index 9efa3407..554e43cf 100644
--- a/web/share/js/keypad.js
+++ b/web/share/js/keypad.js
@@ -69,30 +69,42 @@ export function Keypad(keys_parent, key_callback) {
/************************************************************************/
- self.releaseAll = function(release_hook=false) {
+ self.releaseAll = function() {
for (let dict of [__keys, __modifiers]) {
for (let code in dict) {
if (__isActive(dict[code][0])) {
- self.emit(code, false, release_hook);
+ self.emit(code, false);
}
}
}
};
- self.emit = function(code, state, release_hook=false) {
+ self.emit = function(code, state, fix_mac_cmd=false) {
if (code in __merged) {
__commonHandler(__merged[code][0], state, false);
- if (release_hook) {
- for (let code in __keys) {
+ if (fix_mac_cmd) {
+ __fixMacCmd();
+ }
+ __unholdModifiers();
+ }
+ };
+
+ var __fixMacCmd = function() {
+ if (__isMacCmdActive()) {
+ for (let code in __keys) {
+ setTimeout(function() {
if (__isActive(__keys[code][0])) {
self.emit(code, false);
}
- }
+ }, 100);
}
- __unholdModifiers();
}
};
+ var __isMacCmdActive = function() {
+ return (__isActive(__modifiers["MetaLeft"][0]) || __isActive(__modifiers["MetaRight"][0]));
+ };
+
var __clickHandler = function(el_key, state) {
__commonHandler(el_key, state, false);
__unholdModifiers();