Fix conditional.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@594 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-06-15 17:02:27 +00:00
parent 747573cfad
commit 082133730e
+11 -8
View File
@@ -63,31 +63,34 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
} }
return; return;
} }
var gridBounds = this.getGridBounds();
if (!this.grid || zoomChanged) { if (!this.grid || zoomChanged) {
this._initTiles(); this._initTiles();
} else if ( bounds.top > this.getGridBounds().bottom || } else if ( bounds.top < gridBounds.bottom ||
bounds.left > this.getGridBounds().right || bounds.left > gridBounds.right ||
bounds.right < this.getGridBounds().left || bounds.right < gridBounds.left ||
bounds.bottom < this.getGridBounds().top ) { bounds.bottom > gridBounds.top ) {
console.log("else if");
this._initTiles(); this._initTiles();
} else { } else {
var i = 0; var i = 0;
while (this.getGridBounds().bottom > bounds.bottom) { while (gridBounds.bottom > bounds.bottom) {
this.insertRow(false); this.insertRow(false);
} }
while (this.getGridBounds().left > bounds.left) { while (gridBounds.left > bounds.left) {
this.insertColumn(true); this.insertColumn(true);
} }
while (this.getGridBounds().top < bounds.top) { while (gridBounds.top < bounds.top) {
this.insertRow(true); this.insertRow(true);
} }
while (this.getGridBounds().right < bounds.right) { while (gridBounds.right < bounds.right) {
this.insertColumn(false); this.insertColumn(false);
} }
} }
}, },
getGridBounds:function() { getGridBounds:function() {
if (!this.grid) return null;
var topLeftTile = this.grid[0][0]; var topLeftTile = this.grid[0][0];
var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1]; var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1];
return new OpenLayers.Bounds(topLeftTile.bounds.left, return new OpenLayers.Bounds(topLeftTile.bounds.left,