diff --git a/src/js/core/modal_dialog_elements.js b/src/js/core/modal_dialog_elements.js index 934e2de5..5f0ed59f 100644 --- a/src/js/core/modal_dialog_elements.js +++ b/src/js/core/modal_dialog_elements.js @@ -13,6 +13,17 @@ import { getStringForKeyCode } from "../game/key_action_mapper"; import { createLogger } from "./logging"; import { T } from "../translations"; +/* + * *************************************************** + * + * LEGACY CODE WARNING + * + * This is old code from yorg3.io and needs to be refactored + * @TODO + * + * *************************************************** + */ + const kbEnter = 13; const kbCancel = 27; diff --git a/src/js/core/modal_dialog_forms.js b/src/js/core/modal_dialog_forms.js index 58fd2543..1c5b1986 100644 --- a/src/js/core/modal_dialog_forms.js +++ b/src/js/core/modal_dialog_forms.js @@ -2,6 +2,17 @@ import { BaseItem } from "../game/base_item"; import { ClickDetector } from "./click_detector"; import { Signal } from "./signal"; +/* + * *************************************************** + * + * LEGACY CODE WARNING + * + * This is old code from yorg3.io and needs to be refactored + * @TODO + * + * *************************************************** + */ + export class FormElement { constructor(id, label) { this.id = id; diff --git a/src/js/game/key_action_mapper.js b/src/js/game/key_action_mapper.js index 872db1d2..9fa4ffe1 100644 --- a/src/js/game/key_action_mapper.js +++ b/src/js/game/key_action_mapper.js @@ -122,6 +122,7 @@ export const KEYCODE_RMB = 3; * @returns {string} */ export function getStringForKeyCode(code) { + // @todo: Refactor into dictionary switch (code) { case KEYCODE_LMB: return "LMB"; diff --git a/src/js/game/map_chunk_view.js b/src/js/game/map_chunk_view.js index 5bb5d2c4..848afbab 100644 --- a/src/js/game/map_chunk_view.js +++ b/src/js/game/map_chunk_view.js @@ -104,15 +104,17 @@ export class MapChunkView extends MapChunk { }); parameters.context.imageSmoothingEnabled = true; + const resourcesScale = this.root.app.settings.getAllSettings().mapResourcesScale; // Draw patch items - if (this.root.currentLayer === "regular") { + if (this.root.currentLayer === "regular" && resourcesScale > 0.05) { + const diameter = (70 / Math.pow(parameters.zoomLevel, 0.35)) * (0.2 + 2 * resourcesScale); + for (let i = 0; i < this.patches.length; ++i) { const patch = this.patches[i]; if (patch.item.getItemType() === "shape") { const destX = this.x * dims + patch.pos.x * globalConfig.tileSize; const destY = this.y * dims + patch.pos.y * globalConfig.tileSize; - const diameter = 80 / Math.pow(parameters.zoomLevel, 0.35); patch.item.drawItemCenteredClipped(destX, destY, parameters, diameter); } } diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index 10f38fef..061e3ead 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -267,6 +267,7 @@ export const allApplicationSettings = [ new BoolSetting("rotationByBuilding", enumCategories.advanced, (app, value) => {}), new BoolSetting("displayChunkBorders", enumCategories.advanced, (app, value) => {}), new BoolSetting("pickMinerOnPatch", enumCategories.advanced, (app, value) => {}), + new RangeSetting("mapResourcesScale", enumCategories.advanced, () => null), new EnumSetting("refreshRate", { options: refreshRateOptions, @@ -324,6 +325,7 @@ class SettingsStorage { this.lowQualityTextures = false; this.simplifiedBelts = false; this.zoomToCursor = true; + this.mapResourcesScale = 0.5; /** * @type {Object.} @@ -534,7 +536,7 @@ export class ApplicationSettings extends ReadWriteProxy { } getCurrentVersion() { - return 29; + return 30; } /** @param {{settings: SettingsStorage, version: number}} data */ @@ -672,6 +674,11 @@ export class ApplicationSettings extends ReadWriteProxy { data.version = 29; } + if (data.version < 30) { + data.settings.mapResourcesScale = 0.5; + data.version = 30; + } + return ExplainedResult.good(); } } diff --git a/src/js/profile/setting_types.js b/src/js/profile/setting_types.js index 66c9f01d..4df02892 100644 --- a/src/js/profile/setting_types.js +++ b/src/js/profile/setting_types.js @@ -7,6 +7,17 @@ import { T } from "../translations"; const logger = createLogger("setting_types"); +/* + * *************************************************** + * + * LEGACY CODE WARNING + * + * This is old code from yorg3.io and needs to be refactored + * @TODO + * + * *************************************************** + */ + export class BaseSetting { /** * diff --git a/translations/base-en.yaml b/translations/base-en.yaml index df1f5b25..10d661c5 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -1030,6 +1030,11 @@ settings: description: >- If activated the zoom will happen in the direction of your mouse position, otherwise in the middle of the screen. + mapResourcesScale: + title: Map Resources Size + description: >- + Controls the size of the shapes on the map overview (when zooming out). + keybindings: title: Keybindings hint: >-