From 27e282b35444971777978908f766bd2a72c8df95 Mon Sep 17 00:00:00 2001 From: Moppler Date: Sat, 18 Jul 2020 23:58:38 +0100 Subject: [PATCH] Added new setting allowing for middle mouse scrolling. --- src/js/game/camera.js | 6 +++++- src/js/profile/application_settings.js | 2 ++ translations/base-en.yaml | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/js/game/camera.js b/src/js/game/camera.js index ab73fc83..234214af 100644 --- a/src/js/game/camera.js +++ b/src/js/game/camera.js @@ -437,8 +437,12 @@ export class Camera extends BasicSerializableObject { return; } + const middleMousePressed = event.button === 1 && event.buttons === 4; this.touchPostMoveVelocity = new Vector(0, 0); - if (event.button === 0) { + if ( + event.button === 0 || + (middleMousePressed && this.root.app.settings.getSetting("middleMouseScroll")) + ) { this.combinedSingleTouchStartHandler(event.clientX, event.clientY); } else if (event.button === 1) { this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.middle); diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index 708c4d7b..ad037f02 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -252,6 +252,7 @@ export const allApplicationSettings = [ new BoolSetting("compactBuildingInfo", categoryGame, (app, value) => {}), new BoolSetting("disableCutDeleteWarnings", categoryGame, (app, value) => {}), new BoolSetting("rotationByBuilding", categoryGame, (app, value) => {}), + new BoolSetting("middleMouseScroll", categoryGame, (app, value) => {}), ]; export function getApplicationSettingById(id) { @@ -279,6 +280,7 @@ class SettingsStorage { this.compactBuildingInfo = false; this.disableCutDeleteWarnings = false; this.rotationByBuilding = true; + this.middleMouseScroll = false; this.enableColorBlindHelper = false; diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 64b1777a..4daba3e9 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -774,6 +774,11 @@ settings: description: >- Disables the warning dialogs brought up when cutting/deleting more than 100 entities. + middleMouseScroll: + title: Middle mouse scroll + description: >- + Allows for scrolling with the middle mouse button in addition to left click. + keybindings: title: Keybindings hint: >-