From a5e5cd9e4f59b69b0ce0e99ff12b6305625c5946 Mon Sep 17 00:00:00 2001 From: xSparfuchs Date: Wed, 17 Jun 2020 19:44:53 +0200 Subject: [PATCH] fix large screenshots --- src/js/game/hud/parts/screenshot_exporter.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/game/hud/parts/screenshot_exporter.js b/src/js/game/hud/parts/screenshot_exporter.js index dfdd8224..fe1a52df 100644 --- a/src/js/game/hud/parts/screenshot_exporter.js +++ b/src/js/game/hud/parts/screenshot_exporter.js @@ -55,8 +55,18 @@ export class HUDScreenshotExporter extends BaseHUDPart { const dimensions = maxChunk.sub(minChunk); logger.log("Dimensions:", dimensions); - - const chunkSizePixels = 128; + + let chunkSizePixels = 128; + + if (dimensions.x + dimensions.y > 256) { + if (dimensions.x > dimensions.y) { + chunkSizePixels = Math.floor(128 * (128 / dimensions.x)); + }else{ + chunkSizePixels = Math.floor(128 * (128 / dimensions.y)); + } + logger.log("ChunkSizePixels:", chunkSizePixels); + } + const chunkScale = chunkSizePixels / (globalConfig.mapChunkSize * globalConfig.tileSize); logger.log("Scale:", chunkScale);