diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 2d663fb7..4500779f 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -1444,8 +1444,8 @@ ${escapedMessage} */ private updateCameraOffset(): void { const array = layoutManager.findBiggestAvailableArray(); - let xCenter = (array.xEnd - array.xStart) / 2 + array.xStart; - let yCenter = (array.yEnd - array.yStart) / 2 + array.yStart; + const xCenter = (array.xEnd - array.xStart) / 2 + array.xStart; + const yCenter = (array.yEnd - array.yStart) / 2 + array.yStart; const game = HtmlUtils.querySelectorOrFail('#game canvas'); // Let's put this in Game coordinates by applying the zoom level: diff --git a/front/src/Phaser/Services/HdpiManager.ts b/front/src/Phaser/Services/HdpiManager.ts index 96bc0f40..867c7a53 100644 --- a/front/src/Phaser/Services/HdpiManager.ts +++ b/front/src/Phaser/Services/HdpiManager.ts @@ -38,11 +38,7 @@ export class HdpiManager { let i = 1; - while (true) { - if (realPixelNumber <= this.minRecommendedGamePixelsNumber * i * i) { - break; - } - + while (realPixelNumber > this.minRecommendedGamePixelsNumber * i * i) { i++; } diff --git a/front/src/Phaser/Services/WaScaleManager.ts b/front/src/Phaser/Services/WaScaleManager.ts index 77395675..dfac135e 100644 --- a/front/src/Phaser/Services/WaScaleManager.ts +++ b/front/src/Phaser/Services/WaScaleManager.ts @@ -32,7 +32,7 @@ class WaScaleManager { const style = this.scaleManager.canvas.style; style.width = Math.ceil(realSize.width / devicePixelRatio) + 'px'; style.height = Math.ceil(realSize.height / devicePixelRatio) + 'px'; - }; + } public get zoomModifier(): number { return this.hdpiManager.zoomModifier; diff --git a/front/tests/Phaser/Services/HdpiManagerTest.ts b/front/tests/Phaser/Services/HdpiManagerTest.ts index 4e0787a7..32a6b03a 100644 --- a/front/tests/Phaser/Services/HdpiManagerTest.ts +++ b/front/tests/Phaser/Services/HdpiManagerTest.ts @@ -35,7 +35,7 @@ describe("Test HdpiManager", () => { hdpiManager.zoomModifier = 11; - let result = hdpiManager.getOptimalGameSize({ width: 640, height: 640 }); + const result = hdpiManager.getOptimalGameSize({ width: 640, height: 640 }); expect(result.game.width).toEqual(64); expect(result.game.height).toEqual(64); expect(hdpiManager.zoomModifier).toEqual(10); @@ -47,7 +47,7 @@ describe("Test HdpiManager", () => { hdpiManager.zoomModifier = 1/10; - let result = hdpiManager.getOptimalGameSize({ width: 1280, height: 768 }); + const result = hdpiManager.getOptimalGameSize({ width: 1280, height: 768 }); expect(result.game.width).toEqual(1280); expect(result.game.height).toEqual(768); expect(hdpiManager.zoomModifier).toEqual(1);