[OpenLayers-Commits] r3607 - in sandbox/euzuro/untiled3/lib/OpenLayers: Layer Tile

commits at openlayers.org commits at openlayers.org
Thu Jul 5 19:23:54 EDT 2007


Author: euzuro
Date: 2007-07-05 19:23:53 -0400 (Thu, 05 Jul 2007)
New Revision: 3607

Modified:
   sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
   sandbox/euzuro/untiled3/lib/OpenLayers/Tile/Image.js
Log:
change it so that 'reload' gets fired *instead* of 'loadstart'. significantly simplifies logic in Grid.js

Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js	2007-07-05 23:05:01 UTC (rev 3606)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js	2007-07-05 23:23:53 UTC (rev 3607)
@@ -277,32 +277,20 @@
     addTileMonitoringHooks: function(tile) {
         
         var onLoadStart = function() {
-
-            if (!tile.reloading) {
                 
-                //if there are no tiles loading then trigger a 'loadstart'
-                // event on the layer
-                if (this.numLoadingTiles == 0) {
-                    this.events.triggerEvent("loadstart");
-                }
-                
-                this.numLoadingTiles++;
+            //if there are no tiles loading then trigger a 'loadstart'
+            // event on the layer
+            if (this.numLoadingTiles == 0) {
+                this.events.triggerEvent("loadstart");
             }
+            
+            this.numLoadingTiles++;
+
         };
         tile.events.register("loadstart",
                              this,
                              onLoadStart.bindAsEventListener(this));
-
-       
-        var onReload = function() {
-            //mark the tile as reloading. This is a flag that is checked for
-            // in the 'loadstart' handler.
-            tile.reloading = true;
-        };
-        tile.events.register("reload",
-                             this,
-                             onReload.bindAsEventListener(this));
-        
+      
         var onLoadEnd = function() {
             this.numLoadingTiles--;
             if (this.numLoadingTiles == 0) {

Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Tile/Image.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Tile/Image.js	2007-07-05 23:05:01 UTC (rev 3606)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Tile/Image.js	2007-07-05 23:23:53 UTC (rev 3607)
@@ -90,14 +90,6 @@
      * {Boolean} Always returns true.
      */
     draw:function() {
-        
-        //if we're already loading, we need to send a 'loadcancel' event,
-        // since the 'loadend' will not get fired (since the image will 
-        // not load. This keeps start/finish pairings even.
-        //  
-        if (this.isLoading) {
-            this.events.triggerEvent("reload"); 
-        }
 
         if (this.layer != this.layer.map.baseLayer && this.layer.reproject) {
             this.bounds = this.getBoundsFromBaseLayer(this.position);
@@ -106,9 +98,14 @@
             return false;    
         }
         
-        this.isLoading = true;
-        this.events.triggerEvent("loadstart");
-
+        if (this.isLoading) {
+            //if we're already loading, send 'reload' instead of 'loadstart'.
+            this.events.triggerEvent("reload"); 
+        } else {
+            this.isLoading = true;
+            this.events.triggerEvent("loadstart");
+        }
+        
         if (this.imgDiv == null) {
             this.initImgDiv();
         }



More information about the Commits mailing list