Allow disabling zoom towards cursor

This commit is contained in:
tobspr 2020-10-07 19:12:49 +02:00
parent bc5ffcddd1
commit 38ba763897
4 changed files with 19 additions and 3 deletions

View File

@ -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);

View File

@ -7,7 +7,7 @@ export class HUDBetaOverlay extends BaseHUDPart {
parent,
"ingame_HUD_BetaOverlay",
[],
"<h2>UNSTABLE BETA VERSION</h2><span>Steam Release: 9th October 2020!</span>"
"<h2>UNSTABLE BETA VERSION</h2><span>Unfinalized & potential buggy content!</span>"
);
}

View File

@ -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.<string, number>}
@ -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();
}
}

View File

@ -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: >-