[OpenLayers-Commits] r2048 - trunk/openlayers/lib/OpenLayers

commits at openlayers.org commits at openlayers.org
Wed Dec 13 15:22:30 EST 2006


Author: crschmidt
Date: 2006-12-13 15:22:30 -0500 (Wed, 13 Dec 2006)
New Revision: 2048

Modified:
   trunk/openlayers/lib/OpenLayers/Util.js
Log:
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.


Modified: trunk/openlayers/lib/OpenLayers/Util.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Util.js	2006-12-13 15:53:05 UTC (rev 2047)
+++ trunk/openlayers/lib/OpenLayers/Util.js	2006-12-13 20:22:30 UTC (rev 2048)
@@ -222,9 +222,14 @@
 };
 
 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 = "";
 };
 



More information about the Commits mailing list