From 747573cfad087f9706e37b852fc2557cbecca5fc Mon Sep 17 00:00:00 2001 From: crschmidt Date: Thu, 15 Jun 2006 16:37:15 +0000 Subject: [PATCH] When moving by long distances (whole screenfuls) via API setCenter calls, reinitialize the grid. This solves an 'infinite loop' like problem where if you jumped by a long way, where addColumn/addRow were simply looping for so long that the browser went unresponsive/broken. Fixes issue reported by NickH on users list as well. git-svn-id: http://svn.openlayers.org/trunk/openlayers@593 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Grid.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index cdb6c42835..87b79d87cf 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -65,7 +65,13 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), { } if (!this.grid || zoomChanged) { this._initTiles(); - } else { + } else if ( bounds.top > this.getGridBounds().bottom || + bounds.left > this.getGridBounds().right || + bounds.right < this.getGridBounds().left || + bounds.bottom < this.getGridBounds().top ) { + this._initTiles(); + + } else { var i = 0; while (this.getGridBounds().bottom > bounds.bottom) { this.insertRow(false);