[fusion-commits] r2764 - sandbox/adsk/2.4j/lib

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Aug 6 19:16:41 PDT 2013


Author: liuar
Date: 2013-08-06 19:16:40 -0700 (Tue, 06 Aug 2013)
New Revision: 2764

Modified:
   sandbox/adsk/2.4j/lib/Map.js
Log:
Submit on behalf of Andy Zhang. Integrate 2763 to sandbox/adsk/2.4j
Update zoom method to zoom up or down log2(nFactor) level with fixed scales 

Modified: sandbox/adsk/2.4j/lib/Map.js
===================================================================
--- sandbox/adsk/2.4j/lib/Map.js	2013-08-07 02:12:41 UTC (rev 2763)
+++ sandbox/adsk/2.4j/lib/Map.js	2013-08-07 02:16:40 UTC (rev 2764)
@@ -971,7 +971,7 @@
      *                  - if set to 0 or 1, the map is just recentered
      *                  - if the map has fractional zoom enabled, the map resolution
      *                  will be modified by this factor
-     *                  - with fixed scales, zoom up or down one level, depending on the sign
+     *                  - with fixed scales, zoom up or down log2(nFactor) level
      *
      * Returns: none
      */
@@ -1003,11 +1003,7 @@
             } else {
                 var currentZoomLevel = this.oMapOL.getZoom();
                 this.oMapOL.setCenter(new OpenLayers.LonLat(fX, fY));
-                if (nFactor > 1) {
-                    this.oMapOL.zoomTo(currentZoomLevel+1);
-                } else if (nFactor < 1) {
-                    this.oMapOL.zoomTo(currentZoomLevel-1);
-                }
+                this.oMapOL.zoomTo(currentZoomLevel + Math.floor(Math.log(nFactor) / Math.log(2)));
             }
         }
     },



More information about the fusion-commits mailing list