From 65dea744274b43a5cf716bd2a0bba33331fc6c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Thu, 30 Jan 2014 09:50:34 +0100 Subject: [PATCH] Calculate pixelRatio before using it This fixes a regression introduced by https://github.com/openlayers/ol3/commit/646dd18 where the device pixel ratio was used to determine the tile size even though serverType was not defined for the source. --- src/ol/source/tilewmssource.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index f9b565d426..2cd5989cd4 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -330,6 +330,10 @@ ol.source.TileWMS.prototype.tileUrlFunction_ = return undefined; } + if (pixelRatio != 1 && (!this.hidpi_ || !goog.isDef(this.serverType_))) { + pixelRatio = 1; + } + var tileResolution = tileGrid.getResolution(tileCoord.z); var tileExtent = tileGrid.getTileCoordExtent( tileCoord, this.tmpExtent_); @@ -354,9 +358,6 @@ ol.source.TileWMS.prototype.tileUrlFunction_ = }; goog.object.extend(baseParams, this.params_); - if (pixelRatio != 1 && (!this.hidpi_ || !goog.isDef(this.serverType_))) { - pixelRatio = 1; - } this.pixelRatio_ = pixelRatio; return this.getRequestUrl_(tileCoord, tileSize, tileExtent,