From 38ba7638979fa1df644dbe7ea1ab626bf6f059cc Mon Sep 17 00:00:00 2001 From: tobspr Date: Wed, 7 Oct 2020 19:12:49 +0200 Subject: [PATCH] Allow disabling zoom towards cursor --- src/js/game/camera.js | 6 +++++- src/js/game/hud/parts/beta_overlay.js | 2 +- src/js/profile/application_settings.js | 9 ++++++++- translations/base-en.yaml | 5 +++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/js/game/camera.js b/src/js/game/camera.js index 8f5b850e..107d1fb4 100644 --- a/src/js/game/camera.js +++ b/src/js/game/camera.js @@ -511,7 +511,11 @@ export class Camera extends BasicSerializableObject { this.clampZoomLevel(); this.desiredZoom = null; - const mousePosition = this.root.app.mousePosition; + let mousePosition = this.root.app.mousePosition; + if (!this.root.app.settings.getAllSettings().zoomToCursor) { + mousePosition = new Vector(this.root.gameWidth / 2, this.root.gameHeight / 2); + } + if (mousePosition) { const worldPos = this.root.camera.screenToWorld(mousePosition); const worldDelta = worldPos.sub(this.center); diff --git a/src/js/game/hud/parts/beta_overlay.js b/src/js/game/hud/parts/beta_overlay.js index 1b2fa259..3a515d29 100644 --- a/src/js/game/hud/parts/beta_overlay.js +++ b/src/js/game/hud/parts/beta_overlay.js @@ -7,7 +7,7 @@ export class HUDBetaOverlay extends BaseHUDPart { parent, "ingame_HUD_BetaOverlay", [], - "

UNSTABLE BETA VERSION

Steam Release: 9th October 2020!" + "

UNSTABLE BETA VERSION

Unfinalized & potential buggy content!" ); } diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index 04cde3d9..10f38fef 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -258,6 +258,7 @@ export const allApplicationSettings = [ new BoolSetting("enableMousePan", enumCategories.advanced, (app, value) => {}), new BoolSetting("alwaysMultiplace", enumCategories.advanced, (app, value) => {}), + new BoolSetting("zoomToCursor", enumCategories.advanced, (app, value) => {}), new BoolSetting("clearCursorOnDeleteWhilePlacing", enumCategories.advanced, (app, value) => {}), new BoolSetting("enableTunnelSmartplace", enumCategories.advanced, (app, value) => {}), new BoolSetting("vignette", enumCategories.userInterface, (app, value) => {}), @@ -322,6 +323,7 @@ class SettingsStorage { this.disableTileGrid = false; this.lowQualityTextures = false; this.simplifiedBelts = false; + this.zoomToCursor = true; /** * @type {Object.} @@ -532,7 +534,7 @@ export class ApplicationSettings extends ReadWriteProxy { } getCurrentVersion() { - return 28; + return 29; } /** @param {{settings: SettingsStorage, version: number}} data */ @@ -665,6 +667,11 @@ export class ApplicationSettings extends ReadWriteProxy { data.version = 28; } + if (data.version < 29) { + data.settings.zoomToCursor = true; + data.version = 29; + } + return ExplainedResult.good(); } } diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 0f707c1b..df1f5b25 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -1025,6 +1025,11 @@ settings: description: >- Allows panning the map by moving the cursor to the edges of the screen. The scroll speed depends on the Movement Speed setting. + zoomToCursor: + title: Zoom towards Cursor + description: >- + If activated the zoom will happen in the direction of your mouse position, otherwise in the middle of the screen. + keybindings: title: Keybindings hint: >-