From 708905d28da70482f2e4a58fc8b7f9693fa3713a Mon Sep 17 00:00:00 2001 From: HF Date: Sun, 18 Apr 2021 19:37:20 +0200 Subject: [PATCH] fix right-shift restore over size changes --- src/ui/ChunkLoader2D.js | 6 +++--- src/ui/Renderer2D.js | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ui/ChunkLoader2D.js b/src/ui/ChunkLoader2D.js index 4d3c334..1227077 100644 --- a/src/ui/ChunkLoader2D.js +++ b/src/ui/ChunkLoader2D.js @@ -96,13 +96,13 @@ class ChunkLoader { y: number, historicalDate: string, historicalTime: string, + historicalCanvasSize: number, ) { - const { canvasSize } = this; if (!historicalDate) { return null; } - const [cx, cy] = getChunkOfPixel(canvasSize, x, y); - const px = getCellInsideChunk(canvasSize, [x, y]); + const [cx, cy] = getChunkOfPixel(historicalCanvasSize, x, y); + const px = getCellInsideChunk(historicalCanvasSize, [x, y]); const curTime = Date.now(); if (!historicalTime || historicalTime !== '0000') { diff --git a/src/ui/Renderer2D.js b/src/ui/Renderer2D.js index 07e1c73..7459572 100644 --- a/src/ui/Renderer2D.js +++ b/src/ui/Renderer2D.js @@ -164,9 +164,10 @@ class Renderer { const { historicalDate, historicalTime, + historicalCanvasSize, } = state.canvas; return this.chunkLoader.getHistoricalIndexOfPixel(cx, cy, - historicalDate, historicalTime); + historicalDate, historicalTime, historicalCanvasSize); } return this.chunkLoader.getColorIndexOfPixel(cx, cy); } @@ -176,7 +177,6 @@ class Renderer { ) { const { viewscale, - view, isHistoricalView, } = state.canvas; pixelNotify.updateScale(viewscale); @@ -184,9 +184,6 @@ class Renderer { ? 0 : Math.round(Math.log2(viewscale) / 2); tiledScale = 4 ** tiledScale; - const canvasSize = (isHistoricalView) - ? state.canvas.historicalCanvasSize - : state.canvas.canvasSize; const canvasMaxTiledZoom = (isHistoricalView) ? this.historicalCanvasMaxTiledZoom : this.canvasMaxTiledZoom;