From db0e03e2bdeb64bcbf7eb4fd96000fb2ce9f5796 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Fri, 8 Feb 2008 04:18:13 +0000 Subject: [PATCH] Layers with the 'alpha' flag set to true never register proper load events, so they never fire loadend events. r=euz (Closes #1336) git-svn-id: http://svn.openlayers.org/trunk/openlayers@6068 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Tile/Image.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 5124d484c7..ccce66ba71 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -77,7 +77,11 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { */ destroy: function() { if (this.imgDiv != null) { - OpenLayers.Event.stopObservingElement(this.imgDiv.id); + if (this.layerAlphaHack) { + OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id); + } else { + OpenLayers.Event.stopObservingElement(this.imgDiv.id); + } if (this.imgDiv.parentNode == this.frame) { this.frame.removeChild(this.imgDiv); this.imgDiv.map = null; @@ -246,8 +250,15 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, { this.events.triggerEvent("loadend"); } }; - OpenLayers.Event.observe(this.imgDiv, 'load', - OpenLayers.Function.bind(onload, this)); + + if (this.layerAlphaHack) { + OpenLayers.Event.observe(this.imgDiv.childNodes[0], 'load', + OpenLayers.Function.bind(onload, this)); + } else { + 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.