From 2bffdbb3cbd6ecdd7bbbb3fcc8ca1cf139e44989 Mon Sep 17 00:00:00 2001 From: Michel Bretschneider Date: Sat, 21 Dec 2024 17:36:00 +0100 Subject: [PATCH] Apply suggestions from code review WIP refactor/rename: legacyRotate to inverted, pass via constructor Co-authored-by: Scott Anderson --- ts/RailroadMap.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/ts/RailroadMap.ts b/ts/RailroadMap.ts index ecec84e..0cd4124 100644 --- a/ts/RailroadMap.ts +++ b/ts/RailroadMap.ts @@ -145,16 +145,13 @@ export class RailroadMap { private locator?: Circle | undefined; private remainingTreesAppender?: (trees: Vector[]) => Promise; private readonly mergeLimits: MergeLimits; + private readonly inverted: boolean; - // required for later beta and release maps of RRO - // older maps should still be 180 degrees rotated to match the in-game map - private legacyRotate = false; - - constructor(studio: Studio, element: HTMLElement) { + constructor(studio: Studio, element: HTMLElement, inverted: boolean) { this.setMapModified = (affectsSplines = false) => studio.setMapModified(affectsSplines); this.setTitle = (title) => studio.setTitle(title); this.railroad = studio.railroad; - this.legacyRotate = this.isLegacyRotationSaveGame(); + this.inverted = inverted; this.treeUtil = new TreeUtil(studio, async (before, after, changed, dryrun) => { if (this.remainingTreesAppender) await this.renderTreeArray(changed); if (before === after) { @@ -441,11 +438,9 @@ export class RailroadMap { this.refresh(); return this.legacyRotate; } - isInLegacyOrientationMode(): boolean { - // it may be more appropriate to merge legacyRotate and isInLegacyOrientationMode - // into a public property - // DISCLAIMER I am neither a typescript nor js guy, so tell me what you think - return this.legacyRotate; + + isInverted(): boolean { + return this.inverted; } isLegacyRotationSaveGame(): boolean { const currentVersion = Number(this.railroad.saveGame.version);