Fix drawScale calculation

The goal of using a drawScale was to use the smallest possible canvas (i.e.
one that fits the tile pixel ratio instead of the view pixel ratio) when
composing rotated views. Instead, the drawScale caused a ridiculously
large canvas.
This commit is contained in:
Andreas Hocevar
2016-08-13 11:01:01 +02:00
parent 92e2b72f55
commit bee94d0d4f

View File

@@ -12,7 +12,6 @@ goog.require('ol.extent');
goog.require('ol.render.canvas');
goog.require('ol.render.EventType');
goog.require('ol.renderer.canvas.Layer');
goog.require('ol.size');
/**
@@ -245,10 +244,7 @@ ol.renderer.canvas.TileLayer.prototype.renderTileImages = function(context, fram
if (rotation || hasRenderListeners) {
renderContext = this.context;
var renderCanvas = renderContext.canvas;
var drawZ = tileGrid.getZForResolution(resolution);
var drawTileSize = source.getTilePixelSize(drawZ, pixelRatio, projection);
var tileSize = ol.size.toSize(tileGrid.getTileSize(drawZ));
drawScale = drawTileSize[0] / tileSize[0];
drawScale = source.getTilePixelRatio(pixelRatio) / pixelRatio;
var width = context.canvas.width * drawScale;
var height = context.canvas.height * drawScale;
// Make sure the canvas is big enough for all possible rotation angles