From 2d7f2d2f470caa364b5c205cfe9a92ad511c0ecd Mon Sep 17 00:00:00 2001 From: crschmidt Date: Wed, 13 Dec 2006 20:22:30 +0000 Subject: [PATCH] Commit tschaub's patch for #447. This should let people who are having 'pink tile' problems where right clicking returns the right tile not have problems anymore. Note that this is seperate from TileCache related issues where OpenLayers doesn't request tiles on a grid. Note that I have no reason why this should work. In fact, I'd say it *shouldn't* work, but other people are seeing this problem, so I'm glad to have the code in trunk, since it doesn't change teh default behavior. Thanks to Tim for the patch. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2048 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index 42263ab9e8..a2bac3898e 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -222,9 +222,14 @@ OpenLayers.Util.onImageLoad = function() { }; OpenLayers.Util.onImageLoadErrorColor = "pink"; - +OpenLayers.IMAGE_RELOAD_ATTEMPTS = 0; OpenLayers.Util.onImageLoadError = function() { - this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor; + this._attempts = (this._attempts) ? (this._attempts + 1) : 1; + if(this._attempts <= OpenLayers.IMAGE_RELOAD_ATTEMPTS) { + this.src = this.src; + } else { + this.style.backgroundColor = OpenLayers.Util.onImageLoadErrorColor; + } this.style.display = ""; };