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:
@@ -12,7 +12,6 @@ goog.require('ol.extent');
|
|||||||
goog.require('ol.render.canvas');
|
goog.require('ol.render.canvas');
|
||||||
goog.require('ol.render.EventType');
|
goog.require('ol.render.EventType');
|
||||||
goog.require('ol.renderer.canvas.Layer');
|
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) {
|
if (rotation || hasRenderListeners) {
|
||||||
renderContext = this.context;
|
renderContext = this.context;
|
||||||
var renderCanvas = renderContext.canvas;
|
var renderCanvas = renderContext.canvas;
|
||||||
var drawZ = tileGrid.getZForResolution(resolution);
|
drawScale = source.getTilePixelRatio(pixelRatio) / pixelRatio;
|
||||||
var drawTileSize = source.getTilePixelSize(drawZ, pixelRatio, projection);
|
|
||||||
var tileSize = ol.size.toSize(tileGrid.getTileSize(drawZ));
|
|
||||||
drawScale = drawTileSize[0] / tileSize[0];
|
|
||||||
var width = context.canvas.width * drawScale;
|
var width = context.canvas.width * drawScale;
|
||||||
var height = context.canvas.height * drawScale;
|
var height = context.canvas.height * drawScale;
|
||||||
// Make sure the canvas is big enough for all possible rotation angles
|
// Make sure the canvas is big enough for all possible rotation angles
|
||||||
|
|||||||
Reference in New Issue
Block a user