From e4f8d3b569adc077a7e15b81213f4e60183ea21e Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 27 Jun 2022 17:42:21 +0200 Subject: [PATCH] Fix game on small resolutions --- src/js/game/camera.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/game/camera.js b/src/js/game/camera.js index 4c5def81..fc08d73f 100644 --- a/src/js/game/camera.js +++ b/src/js/game/camera.js @@ -168,7 +168,11 @@ export class Camera extends BasicSerializableObject { * Finds a good initial zoom level */ findInitialZoom() { - const desiredWorldSpaceWidth = 18 * globalConfig.tileSize; + let desiredWorldSpaceWidth = 18 * globalConfig.tileSize; + if (window.innerWidth < 1000) { + desiredWorldSpaceWidth = 12 * globalConfig.tileSize; + } + const zoomLevelX = this.root.gameWidth / desiredWorldSpaceWidth; const zoomLevelY = this.root.gameHeight / desiredWorldSpaceWidth;