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:
@@ -122,21 +122,6 @@ OpenLayers.Tile.Image.IFrame = OpenLayers.Class(OpenLayers.Tile.Image, {
|
|||||||
|
|
||||||
// we need this reference to check back the viewRequestID
|
// we need this reference to check back the viewRequestID
|
||||||
this.imgDiv.map = this.layer.map;
|
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,
|
OpenLayers.Util.modifyDOMElement(iframe, id,
|
||||||
new OpenLayers.Pixel(0,0), this.layer.getImageSize(), "absolute");
|
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;
|
return iframe;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,8 @@
|
|||||||
layer = new OpenLayers.Layer.WMS.Post(name, wmsUrl, {layers: 'basic'});
|
layer = new OpenLayers.Layer.WMS.Post(name, wmsUrl, {layers: 'basic'});
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
var tile = new OpenLayers.Tile.Image.IFrame(layer, position, bounds, url, size);
|
var tile = new OpenLayers.Tile.Image.IFrame(layer, position, bounds, url, size);
|
||||||
var imgDiv = tile.createImgDiv();
|
tile.renderTile();
|
||||||
|
var imgDiv = tile.imgDiv;
|
||||||
var iFrame = imgDiv.firstChild;
|
var iFrame = imgDiv.firstChild;
|
||||||
var eventPane = imgDiv.childNodes[1];
|
var eventPane = imgDiv.childNodes[1];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user