Passive listeners, Touch devices

The touch move events need to block the call to preventDefault (), for a better touch response, the delay in scrolling could improve up to 300 [ms], the test was done on Ipad Air 2 with the audit function of Chrome.

With `{passive: true}` touch and wheel listeners, the Developers promises not to call preventDefault () to disable scrolling.
This commit is contained in:
Alex Bernal 2018-08-05 15:33:42 -05:00 committed by GitHub
parent 24231f1ae3
commit 3e34d49e98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -258,26 +258,27 @@ var UI = {
document.documentElement
.addEventListener('mousedown', UI.keepVirtualKeyboard, true);
// passive event listeners won't call preventDefault() to disable scrolling
document.getElementById("noVNC_control_bar")
.addEventListener('touchstart', UI.activateControlbar);
.addEventListener('touchstart', UI.activateControlbar, {passive: true});
document.getElementById("noVNC_control_bar")
.addEventListener('touchmove', UI.activateControlbar);
.addEventListener('touchmove', UI.activateControlbar, {passive: true});
document.getElementById("noVNC_control_bar")
.addEventListener('touchend', UI.activateControlbar);
document.getElementById("noVNC_control_bar")
.addEventListener('input', UI.activateControlbar);
document.getElementById("noVNC_control_bar")
.addEventListener('touchstart', UI.keepControlbar);
.addEventListener('touchstart', UI.keepControlbar, {passive: true});
document.getElementById("noVNC_control_bar")
.addEventListener('input', UI.keepControlbar);
document.getElementById("noVNC_control_bar_handle")
.addEventListener('touchstart', UI.controlbarHandleMouseDown);
.addEventListener('touchstart', UI.controlbarHandleMouseDown, {passive: true});
document.getElementById("noVNC_control_bar_handle")
.addEventListener('touchend', UI.controlbarHandleMouseUp);
document.getElementById("noVNC_control_bar_handle")
.addEventListener('touchmove', UI.dragControlbarHandle);
.addEventListener('touchmove', UI.dragControlbarHandle, {passive: true});
},
addExtraKeysHandlers: function() {