Use device instead of data pixel ratio to determine canvas size

This commit is contained in:
Andreas Hocevar
2022-07-10 17:33:36 +02:00
parent 6086459cba
commit f3a05ba82d
3 changed files with 8 additions and 11 deletions

View File

@@ -268,10 +268,8 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
const resolution = frameState.viewState.resolution;
const tilePixelRatio = tileSource.getTilePixelRatio(pixelRatio);
// desired dimensions of the canvas in pixels
const width = Math.round((getWidth(extent) / resolution) * tilePixelRatio);
const height = Math.round(
(getHeight(extent) / resolution) * tilePixelRatio
);
const width = Math.round((getWidth(extent) / resolution) * pixelRatio);
const height = Math.round((getHeight(extent) / resolution) * pixelRatio);
const layerExtent =
layerState.extent && fromUserExtent(layerState.extent, projection);
@@ -369,15 +367,16 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
}
}
const canvasScale = tileResolution / viewResolution;
const canvasScale =
((tileResolution / viewResolution) * pixelRatio) / tilePixelRatio;
// set forward and inverse pixel transforms
composeTransform(
this.pixelTransform,
frameState.size[0] / 2,
frameState.size[1] / 2,
1 / tilePixelRatio,
1 / tilePixelRatio,
1 / pixelRatio,
1 / pixelRatio,
rotation,
-width / 2,
-height / 2