fix right-shift restore over size changes

This commit is contained in:
HF 2021-04-18 19:37:20 +02:00
parent f0efda1d5f
commit 708905d28d
2 changed files with 5 additions and 8 deletions

View File

@ -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') {

View File

@ -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;