load events not working properly in OpenLayers.Tile.Image.IFrame, r=fvanderbiest (closes #2406)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10082 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2010-02-23 17:16:49 +00:00
parent 09a858559b
commit ac60e4fcf6
2 changed files with 19 additions and 16 deletions

View File

@@ -122,21 +122,6 @@ OpenLayers.Tile.Image.IFrame = OpenLayers.Class(OpenLayers.Tile.Image, {
// we need this reference to check back the viewRequestID
this.imgDiv.map = this.layer.map;
//bind a listener to the onload of the iframe so that we
// can register when a tile has finished loading.
var onload = function() {
this.show();
//normally isLoading should always be true here but there are some
// right funky conditions where loading and then reloading a tile
// with the same url *really*fast*. this check prevents sending
// a 'loadend' if the msg has already been sent
//
if (this.isLoading) {
this.isLoading = false;
this.events.triggerEvent("loadend");
}
};
},
/**
@@ -206,6 +191,23 @@ OpenLayers.Tile.Image.IFrame = OpenLayers.Class(OpenLayers.Tile.Image, {
OpenLayers.Util.modifyDOMElement(iframe, id,
new OpenLayers.Pixel(0,0), this.layer.getImageSize(), "absolute");
//bind a listener to the onload of the iframe so that we
// can register when a tile has finished loading.
var onload = function() {
this.show();
//normally isLoading should always be true here but there are some
// right funky conditions where loading and then reloading a tile
// with the same url *really*fast*. this check prevents sending
// a 'loadend' if the msg has already been sent
//
if (this.isLoading) {
this.isLoading = false;
this.events.triggerEvent("loadend");
}
};
OpenLayers.Event.observe(iframe, 'load',
OpenLayers.Function.bind(onload, this));
return iframe;
},