only change bounds when wrapDateLine is true; remove unused variable

This commit is contained in:
ahocevar
2011-09-27 07:38:22 -06:00
parent 61a3c2a072
commit 99d012f321
2 changed files with 12 additions and 11 deletions
+9 -7
View File
@@ -404,13 +404,15 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/ */
calculateGridLayout: function(bounds, origin, resolution) { calculateGridLayout: function(bounds, origin, resolution) {
bounds = bounds.clone(); bounds = bounds.clone();
var maxExtent = this.map.getMaxExtent(), if (this.map.baseLayer.wrapDateLine) {
width = maxExtent.getWidth(); var maxExtent = this.map.getMaxExtent(),
// move the bounds one world width to the right until the origin is width = maxExtent.getWidth();
// within the world extent // move the bounds one world width to the right until the origin is
while (bounds.left < maxExtent.left) { // within the world extent
bounds.left += width; while (bounds.left < maxExtent.left) {
bounds.right += width; bounds.left += width;
bounds.right += width;
}
} }
var tilelon = resolution * this.tileSize.w; var tilelon = resolution * this.tileSize.w;
+2 -3
View File
@@ -215,9 +215,8 @@ OpenLayers.Tile = OpenLayers.Class({
*/ */
setBounds: function(bounds) { setBounds: function(bounds) {
bounds = bounds.clone(); bounds = bounds.clone();
var maxExtent = this.layer.maxExtent, var worldExtent = this.layer.map.getMaxExtent();
worldExtent = this.layer.map.getMaxExtent(); if (this.layer.map.baseLayer.wrapDateLine) {
if (maxExtent && this.layer.map.baseLayer.wrapDateLine) {
bounds = bounds.wrapDateLine(worldExtent); bounds = bounds.wrapDateLine(worldExtent);
} }
this.bounds = bounds; this.bounds = bounds;