[fusion-commits] r2763 - trunk/lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Aug 6 19:12:41 PDT 2013
Author: liuar
Date: 2013-08-06 19:12:41 -0700 (Tue, 06 Aug 2013)
New Revision: 2763
Modified:
trunk/lib/Map.js
Log:
Submit on behalf of Andy Zhang.
Update zoom method to zoom up or down log2(nFactor) level with fixed scales
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2013-08-06 07:37:05 UTC (rev 2762)
+++ trunk/lib/Map.js 2013-08-07 02:12:41 UTC (rev 2763)
@@ -1243,7 +1243,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
*/
@@ -1275,11 +1275,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