From e1bbe2de17ebfef5f6c85c3530cf2854abc2cdc1 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 22 Jun 2020 12:33:28 +0200 Subject: [PATCH] Prevent all default keybindings, closes #254 --- src/js/changelog.js | 1 + src/js/core/input_distributor.js | 12 +----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/js/changelog.js b/src/js/changelog.js index 70736542..055b991f 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -8,6 +8,7 @@ export const CHANGELOG = [ "Add setting to disable cut/delete warnings (by hexy)", "Fix bug where belts in blueprints don't orient correctly (by hexy)", "Update tutorial image for tier 2 tunnels to explain mix/match (by jimmyshadow1)", + "Prevent default actions on all keybindings in the web version so you don't accidentally use builtin browser shortcuts", ], }, { diff --git a/src/js/core/input_distributor.js b/src/js/core/input_distributor.js index 03ad8e0c..a59f4fbc 100644 --- a/src/js/core/input_distributor.js +++ b/src/js/core/input_distributor.js @@ -191,17 +191,7 @@ export class InputDistributor { */ handleKeyMouseDown(event) { const keyCode = event instanceof MouseEvent ? event.button + 1 : event.keyCode; - if ( - keyCode === 4 || // MB4 - keyCode === 5 || // MB5 - keyCode === 9 || // TAB - keyCode === 16 || // SHIFT - keyCode === 17 || // CTRL - keyCode === 18 || // ALT - (keyCode >= 112 && keyCode < 122) // F1 - F10 - ) { - event.preventDefault(); - } + event.preventDefault(); const isInitial = !this.keysDown.has(keyCode); this.keysDown.add(keyCode);