OpenLayers OpenLayers

Ticket #842: Image.js.patch

File Image.js.patch, 1.1 kB (added by ahocevar, 1 year ago)
  • lib/OpenLayers/Tile/Image.js

    old new  
    216216        OpenLayers.Event.observe(this.imgDiv, 'load', 
    217217                                 OpenLayers.Function.bind(onload, this)); 
    218218 
     219        // Bind a listener to the onerror of the image div so that we 
     220        // can registere when a tile has finished loading with errors. 
     221        var onerror = function() { 
     222 
     223            // If we have gone through all image reload attempts, it is time 
     224            // to realize that we are done with this image. Since 
     225            // OpenLayers.Util.onImageLoadError already has taken care about 
     226            // the error, we can continue as if the image was loaded 
     227            // successfully. 
     228            if (this.imgDiv._attempts > OpenLayers.IMAGE_RELOAD_ATTEMPTS) { 
     229                onload.call(this); 
     230            } 
     231        }; 
     232        OpenLayers.Event.observe(this.imgDiv, "error", 
     233                                 OpenLayers.Function.bind(onerror, this)); 
    219234    }, 
    220235 
    221236    /**