protect for null bounds (not-loaded map)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@993 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-21 18:22:37 +00:00
parent 02efb5c213
commit 96c3720aab
2 changed files with 30 additions and 22 deletions

View File

@@ -135,28 +135,33 @@ OpenLayers.Layer.Grid.prototype =
* @param {Boolean} minor
*/
moveTo:function(bounds, zoomChanged, minor) {
if (!this.getVisibility()) {
if (zoomChanged) {
//now clear out the old grid and start a new one
this.clearGrid();
this.grid = null;
}
} else {
if (!this.grid || zoomChanged) {
this._initTiles();
} else {
var i = 0;
while (this.getGridBounds().bottom > bounds.bottom) {
this.insertRow(false);
if (bounds == null) {
bounds = this.map.getBounds();
}
if (bounds != null) {
if (!this.getVisibility()) {
if (zoomChanged) {
//now clear out the old grid and start a new one
this.clearGrid();
this.grid = null;
}
while (this.getGridBounds().left > bounds.left) {
this.insertColumn(true);
}
while (this.getGridBounds().top < bounds.top) {
this.insertRow(true);
}
while (this.getGridBounds().right < bounds.right) {
this.insertColumn(false);
} else {
if (!this.grid || zoomChanged) {
this._initTiles();
} else {
var i = 0;
while (this.getGridBounds().bottom > bounds.bottom) {
this.insertRow(false);
}
while (this.getGridBounds().left > bounds.left) {
this.insertColumn(true);
}
while (this.getGridBounds().top < bounds.top) {
this.insertRow(true);
}
while (this.getGridBounds().right < bounds.right) {
this.insertColumn(false);
}
}
}
}