This is a simple patch to avoid the flash problem when using singleTile
layer.

--- E:/OpenLayers-svn/lib/OpenLayers/Tile/Image.js    Wed Nov 28 14:13:24
2007
+++ E:/OpenLayers-2.5/lib/OpenLayers/Tile/Image.js    Thu Dec 06 09:52:54
2007
@@ -120,8 +120,13 @@

         this.url = this.layer.getURL(this.bounds);
         // position the frame
-        OpenLayers.Util.modifyDOMElement(this.frame,
+        if (this.layer.singleTile) {
+            OpenLayers.Util.modifyDOMElement(this.frame,
+                                         null, null, this.size);
+        } else {
+            OpenLayers.Util.modifyDOMElement(this.frame,
                                          null, this.position, this.size);

+        }

         var imageSize = this.layer.getImageSize();
         if (this.layerAlphaHack) {
@@ -141,7 +146,7 @@
      *   be reused in a new location.
      */
     clear: function() {
-        if(this.imgDiv) {
+        if(this.imgDiv && !this.layer.singleTile) {
             this.imgDiv.style.display = "none";
         }
     },
@@ -203,6 +208,9 @@
         // can register when a tile has finished loading.
         var onload = function() {

+            if (this.layer.singleTile) {
+                OpenLayers.Util.modifyDOMElement(this.frame, null,
this.position);
+            }
             //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


BTW: The edit toolbar also have the flash problem when zoom and pan the map.
I found if we add the controls into the div [not viewPortDiv]  of the map,
we can avoid this problem.

-- 
Li XinGang
EMail: [EMAIL PROTECTED]
Blog:   avlee.cnblogs.com

Attachment: Image_SingleTile_NoFlash.patch
Description: Binary data

_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to