From 082133730e8d2dd2f1f272bc84ae47f7f48f1685 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 15 Jun 2006 17:02:27 +0000 Subject: [PATCH] Fix conditional. git-svn-id: http://svn.openlayers.org/trunk/openlayers@594 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Grid.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 87b79d87cf..c66807717b 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -63,31 +63,34 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), { } return; } + var gridBounds = this.getGridBounds(); if (!this.grid || zoomChanged) { this._initTiles(); - } else if ( bounds.top > this.getGridBounds().bottom || - bounds.left > this.getGridBounds().right || - bounds.right < this.getGridBounds().left || - bounds.bottom < this.getGridBounds().top ) { + } else if ( bounds.top < gridBounds.bottom || + bounds.left > gridBounds.right || + bounds.right < gridBounds.left || + bounds.bottom > gridBounds.top ) { + console.log("else if"); this._initTiles(); } else { var i = 0; - while (this.getGridBounds().bottom > bounds.bottom) { + while (gridBounds.bottom > bounds.bottom) { this.insertRow(false); } - while (this.getGridBounds().left > bounds.left) { + while (gridBounds.left > bounds.left) { this.insertColumn(true); } - while (this.getGridBounds().top < bounds.top) { + while (gridBounds.top < bounds.top) { this.insertRow(true); } - while (this.getGridBounds().right < bounds.right) { + while (gridBounds.right < bounds.right) { this.insertColumn(false); } } }, getGridBounds:function() { + if (!this.grid) return null; var topLeftTile = this.grid[0][0]; var bottomRightTile = this.grid[this.grid.length-1][this.grid[0].length-1]; return new OpenLayers.Bounds(topLeftTile.bounds.left,