diff --git a/src/js/game/camera.js b/src/js/game/camera.js index 234214af..fad36415 100644 --- a/src/js/game/camera.js +++ b/src/js/game/camera.js @@ -437,12 +437,8 @@ export class Camera extends BasicSerializableObject { return; } - const middleMousePressed = event.button === 1 && event.buttons === 4; this.touchPostMoveVelocity = new Vector(0, 0); - if ( - event.button === 0 || - (middleMousePressed && this.root.app.settings.getSetting("middleMouseScroll")) - ) { + if (event.button === 0) { this.combinedSingleTouchStartHandler(event.clientX, event.clientY); } else if (event.button === 1) { this.downPreHandler.dispatch(new Vector(event.clientX, event.clientY), enumMouseButton.middle); @@ -466,7 +462,10 @@ export class Camera extends BasicSerializableObject { return; } - if (event.button === 0) { + if ( + (!this.root.app.settings.getSetting("middleMousePan") && event.button === 0) || + (this.root.app.settings.getSetting("middleMousePan") && event.button === 1) + ) { this.combinedSingleTouchMoveHandler(event.clientX, event.clientY); } diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index ad037f02..8421bb97 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -252,7 +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) => {}), + new BoolSetting("middleMousePan", categoryGame, (app, value) => {}), ]; export function getApplicationSettingById(id) { @@ -280,7 +280,7 @@ class SettingsStorage { this.compactBuildingInfo = false; this.disableCutDeleteWarnings = false; this.rotationByBuilding = true; - this.middleMouseScroll = false; + this.middleMousePan = false; this.enableColorBlindHelper = false; diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 4daba3e9..fb5b7abf 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -774,10 +774,10 @@ settings: description: >- Disables the warning dialogs brought up when cutting/deleting more than 100 entities. - middleMouseScroll: - title: Middle mouse scroll + middleMousePan: + title: Pan camera with middle click description: >- - Allows for scrolling with the middle mouse button in addition to left click. + Click with the middle mouse button instead of left click to pan the camera. Allows panning camera while a building is selected. keybindings: title: Keybindings