From c3b66743fed7d952be40c88781658e599ef31616 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Mon, 15 Aug 2016 10:15:17 -0400 Subject: [PATCH] Added a pixelRatio adjust to the canvasTileLayer 'forEachLayerAtPixel' method This method was composing a frame that was only accurate for devices with a pixelRatio of 1. Now the canvas widths and heights are multiplied beforehand by the pixelRatio. #5601 --- src/ol/renderer/canvas/tilelayer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ol/renderer/canvas/tilelayer.js b/src/ol/renderer/canvas/tilelayer.js index 8bd2cde1a2..914e6015aa 100644 --- a/src/ol/renderer/canvas/tilelayer.js +++ b/src/ol/renderer/canvas/tilelayer.js @@ -198,8 +198,9 @@ ol.renderer.canvas.TileLayer.prototype.forEachLayerAtPixel = function( pixel, frameState, callback, thisArg) { var canvas = this.context.canvas; var size = frameState.size; - canvas.width = size[0]; - canvas.height = size[1]; + var pixelRatio = frameState.pixelRatio; + canvas.width = size[0] * pixelRatio; + canvas.height = size[1] * pixelRatio; this.composeFrame(frameState, this.getLayer().getLayerState(), this.context); var imageData = this.context.getImageData(