[fusion-commits] r1659 - trunk/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Nov 11 13:40:36 EST 2008


Author: madair
Date: 2008-11-11 13:40:36 -0500 (Tue, 11 Nov 2008)
New Revision: 1659

Modified:
   trunk/lib/Map.js
Log:
closes #165: add a timeout to the wheel events

Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js	2008-11-10 20:40:11 UTC (rev 1658)
+++ trunk/lib/Map.js	2008-11-11 18:40:36 UTC (rev 1659)
@@ -254,6 +254,7 @@
                             newCenter.lat - size.h*newRes/2,
                             newCenter.lon + size.w*newRes/2,
                             newCenter.lat + size.h*newRes/2);
+        this.wheelDelay = null;
         this.setExtents(newBounds);
     },
 
@@ -265,7 +266,11 @@
      * evt - {Event}
      */
     wheelUp: function(evt) {
-        this.wheelChange(evt, 1);
+      if (this.wheelDelay) {
+        window.clearTimeout(this.wheelDelay);
+      }
+      this.wheelDelay = window.setTimeout(OpenLayers.Function.bind(this.wheelChange, this, evt, 1),200);
+      //  this.wheelChange(evt, 1);
     },
 
     /** 
@@ -276,7 +281,11 @@
      * evt - {Event}
      */
     wheelDown: function(evt) {
-        this.wheelChange(evt, -1);
+      if (this.wheelDelay) {
+        window.clearTimeout(this.wheelDelay);
+      }
+      this.wheelDelay = window.setTimeout(OpenLayers.Function.bind(this.wheelChange, this, evt, -1),200);
+      //  this.wheelChange(evt, -1);
     },
 
     /**



More information about the fusion-commits mailing list