fix for #480 -- addition of 'viewRequestID' variable to map to keep track of the changing view requests so that images dont load when they are no longer needed. muchas gracias to senior woodall for his help getting this patch together

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2231 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-02-16 20:24:56 +00:00
parent 8095e22600
commit 3309b0b12e
4 changed files with 47 additions and 3 deletions
+20
View File
@@ -77,6 +77,18 @@ OpenLayers.Map.prototype = {
/** @type int */
zoom: 0,
/** Used to store a unique identifier that changes when the map view
* changes. viewRequestID should be used when adding data asynchronously
* to the map: viewRequestID is incremented when you initiate your
* request (right now during changing of baselayers and changing of zooms).
* It is stored here in the map and also in the data that will be coming
* back asynchronously. Before displaying this data on request completion,
* we check that the viewRequestID of the data is still the same as that
* of the map. Fix for #480
*
* @type String */
viewRequestID: 0,
// Options
/** @type OpenLayers.Size */
@@ -448,6 +460,11 @@ OpenLayers.Map.prototype = {
// set new baselayer and make it visible
this.baseLayer = newBaseLayer;
// Increment viewRequestID since the baseLayer is
// changing. This is used by tiles to check if they should
// draw themselves.
this.viewRequestID++;
this.baseLayer.setVisibility(true, noEvent);
//redraw all layers
@@ -743,6 +760,9 @@ OpenLayers.Map.prototype = {
for (var i = 0; i < this.popups.length; i++) {
this.popups[i].updatePosition();
}
// zoom level has changed, increment viewRequestID.
this.viewRequestID++;
}
var bounds = this.getExtent();