From 99d012f32156bd4e86dd4098f16d0a14b700870e Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 27 Sep 2011 07:38:22 -0600 Subject: [PATCH] only change bounds when wrapDateLine is true; remove unused variable --- lib/OpenLayers/Layer/Grid.js | 18 ++++++++++-------- lib/OpenLayers/Tile.js | 5 ++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 2cb41a72fc..696d6e92cf 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -404,14 +404,16 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { */ calculateGridLayout: function(bounds, origin, resolution) { bounds = bounds.clone(); - var maxExtent = this.map.getMaxExtent(), - width = maxExtent.getWidth(); - // move the bounds one world width to the right until the origin is - // within the world extent - while (bounds.left < maxExtent.left) { - bounds.left += width; - bounds.right += width; - } + if (this.map.baseLayer.wrapDateLine) { + var maxExtent = this.map.getMaxExtent(), + width = maxExtent.getWidth(); + // move the bounds one world width to the right until the origin is + // within the world extent + while (bounds.left < maxExtent.left) { + bounds.left += width; + bounds.right += width; + } + } var tilelon = resolution * this.tileSize.w; var tilelat = resolution * this.tileSize.h; diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index adfbceb9ba..3266ce7902 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -215,9 +215,8 @@ OpenLayers.Tile = OpenLayers.Class({ */ setBounds: function(bounds) { bounds = bounds.clone(); - var maxExtent = this.layer.maxExtent, - worldExtent = this.layer.map.getMaxExtent(); - if (maxExtent && this.layer.map.baseLayer.wrapDateLine) { + var worldExtent = this.layer.map.getMaxExtent(); + if (this.layer.map.baseLayer.wrapDateLine) { bounds = bounds.wrapDateLine(worldExtent); } this.bounds = bounds;