Use passive touchstart events

Due to possible scroll blocking.
This commit is contained in:
Sergey Stepanov 2021-04-13 13:02:56 +03:00
parent efd8679de3
commit 2a1bdbb3c9
No known key found for this signature in database
GPG key ID: A56B4929BAA8556B
2 changed files with 3 additions and 3 deletions

View file

@ -428,7 +428,7 @@
event.sub(GAMEPAD_DISCONNECTED, () => message.show('Gamepad disconnected'));
// touch stuff
event.sub(MENU_HANDLER_ATTACHED, (data) => {
menuScreen.addEventListener(data.event, data.handler);
menuScreen.addEventListener(data.event, data.handler, {passive: true});
});
event.sub(KEY_PRESSED, onKeyPress);
event.sub(KEY_RELEASED, onKeyRelease);

View file

@ -262,13 +262,13 @@ const touch = (() => {
// touch/mouse events for control buttons. mouseup events is binded to window.
buttons.forEach((btn) => {
btn.addEventListener('mousedown', handleButtonDown);
btn.addEventListener('touchstart', handleButtonDown);
btn.addEventListener('touchstart', handleButtonDown, {passive: true});
btn.addEventListener('touchend', handleButtonUp);
});
// touch/mouse events for dpad. mouseup events is binded to window.
vpadHolder.addEventListener('mousedown', handleVpadJoystickDown);
vpadHolder.addEventListener('touchstart', handleVpadJoystickDown);
vpadHolder.addEventListener('touchstart', handleVpadJoystickDown, {passive: true});
vpadHolder.addEventListener('touchend', handleVpadJoystickUp);
dpad.forEach((arrow) => {