Do not cache data from aborted tile loads
This also results in a simplified cache method that can more easily be overridden for use with other storage providers.
This commit is contained in:
@@ -262,8 +262,9 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
* loaded, as a means of progress update to listeners.
|
||||
* listeners can access 'numLoadingTiles' if they wish to keep
|
||||
* track of the loading progress. Listeners are called with an object
|
||||
* with a tile property as first argument, making the loded tile
|
||||
* available to the listener.
|
||||
* with a 'tile' property as first argument, making the loded tile
|
||||
* available to the listener, and an 'aborted' property, which will be
|
||||
* true when loading was aborted and no tile data is available.
|
||||
* tileerror - Triggered before the tileloaded event (i.e. when the tile is
|
||||
* still hidden) if a tile failed to load. Listeners receive an object
|
||||
* as first argument, which has a tile property that references the
|
||||
@@ -1090,9 +1091,12 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
this.numLoadingTiles++;
|
||||
};
|
||||
|
||||
tile.onLoadEnd = function() {
|
||||
tile.onLoadEnd = function(evt) {
|
||||
this.numLoadingTiles--;
|
||||
this.events.triggerEvent("tileloaded", {tile: tile});
|
||||
this.events.triggerEvent("tileloaded", {
|
||||
tile: tile,
|
||||
aborted: evt.type === "unload"
|
||||
});
|
||||
//if that was the last tile, then trigger a 'loadend' on the layer
|
||||
if (this.tileQueue.length === 0 && this.numLoadingTiles === 0) {
|
||||
this.loading = false;
|
||||
|
||||
Reference in New Issue
Block a user