summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-08-19 06:41:10 +0300
committerDevaev Maxim <[email protected]>2018-08-19 06:41:10 +0300
commite389b7a302910670939bfc69bd3609716382b761 (patch)
tree27ae4b660781590e8206a71bdd5dab774250f679
parentb1c142892304cb09c0e1d930880c9233aeff0dc0 (diff)
full touch support for keyboard
-rw-r--r--kvmd/web/js/keyboard.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/kvmd/web/js/keyboard.js b/kvmd/web/js/keyboard.js
index 41fa4813..45a15ac0 100644
--- a/kvmd/web/js/keyboard.js
+++ b/kvmd/web/js/keyboard.js
@@ -32,6 +32,8 @@ function Keyboard() {
__clickHandler(el_key, false);
}
};
+ el_key.ontouchstart = (event) => __touchHandler(event, el_key, true);
+ el_key.ontouchend = (event) => __touchHandler(event, el_key, false);
__keys.push(el_key);
});
@@ -101,6 +103,12 @@ function Keyboard() {
}
};
+ var __touchHandler = function(event, el_key, state) {
+ event.stopPropagation();
+ event.preventDefault();
+ __clickHandler(el_key, state);
+ };
+
var __clickHandler = function(el_key, state) {
__commonHandler(el_key, state, "pressed");
__unholdModifiers();