Tile.Image should register for error events with respect to tile loading
events -- this means that if an image fails to load, it will still trigger a loadend event, and the layer will eventually be in a state where it is no longer waiting to load. Thanks to Andreas for the investigation! (Closes #842) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5428 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -216,6 +216,21 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
OpenLayers.Event.observe(this.imgDiv, 'load',
|
||||
OpenLayers.Function.bind(onload, this));
|
||||
|
||||
// Bind a listener to the onerror of the image div so that we
|
||||
// can registere when a tile has finished loading with errors.
|
||||
var onerror = function() {
|
||||
|
||||
// If we have gone through all image reload attempts, it is time
|
||||
// to realize that we are done with this image. Since
|
||||
// OpenLayers.Util.onImageLoadError already has taken care about
|
||||
// the error, we can continue as if the image was loaded
|
||||
// successfully.
|
||||
if (this.imgDiv._attempts > OpenLayers.IMAGE_RELOAD_ATTEMPTS) {
|
||||
onload.call(this);
|
||||
}
|
||||
};
|
||||
OpenLayers.Event.observe(this.imgDiv, "error",
|
||||
OpenLayers.Function.bind(onerror, this));
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user