mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Handle events via addEventListener(). This solves an issue with touch events firing twice (they were firing once for bubble and once for capture). With addEventListener(), they fire once.
This commit is contained in:
@@ -266,8 +266,7 @@ Guacamole.OnScreenKeyboard = function(url) {
|
|||||||
row.appendChild(key_container_element);
|
row.appendChild(key_container_element);
|
||||||
|
|
||||||
// Set up click handler for key
|
// Set up click handler for key
|
||||||
key_element.onmousedown =
|
function press(e) {
|
||||||
key_element.ontouchstart = function() {
|
|
||||||
|
|
||||||
// Press key if not yet pressed
|
// Press key if not yet pressed
|
||||||
if (!key.pressed) {
|
if (!key.pressed) {
|
||||||
@@ -306,11 +305,14 @@ Guacamole.OnScreenKeyboard = function(url) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
key_element.onmouseup =
|
key_element.addEventListener("mousedown", press, true);
|
||||||
key_element.onmouseout =
|
key_element.addEventListener("touchstart", press, true);
|
||||||
key_element.ontouchend = function() {
|
|
||||||
|
function release(e) {
|
||||||
|
|
||||||
// Release key if currently pressed
|
// Release key if currently pressed
|
||||||
if (key.pressed) {
|
if (key.pressed) {
|
||||||
@@ -329,8 +331,14 @@ Guacamole.OnScreenKeyboard = function(url) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
key_element.addEventListener("mouseup", release, true);
|
||||||
|
key_element.addEventListener("mouseout", release, true);
|
||||||
|
key_element.addEventListener("touchend", release, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user