[fusion-commits] r1410 - in trunk: MapGuide lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon May 26 10:51:59 EDT 2008
Author: madair
Date: 2008-05-26 10:51:59 -0400 (Mon, 26 May 2008)
New Revision: 1410
Modified:
trunk/MapGuide/MapGuide.js
trunk/lib/Map.js
Log:
re #63: if a fixed set of scales is used, then fractionalZoom is false and map.zoom method will increment/decrement the fixed zoom level.
Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js 2008-05-15 20:21:20 UTC (rev 1409)
+++ trunk/MapGuide/MapGuide.js 2008-05-26 14:51:59 UTC (rev 1410)
@@ -290,6 +290,8 @@
//add in scales array if supplied
if (o.FiniteDisplayScales && o.FiniteDisplayScales.length>0) {
this.scales = o.FiniteDisplayScales;
+ this.mapWidget.fractionalZoom = false;
+ this.mapWidget.oMapOL.fractionalZoom = false;
}
//remove this layer if it was already created
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2008-05-15 20:21:20 UTC (rev 1409)
+++ trunk/lib/Map.js 2008-05-26 14:51:59 UTC (rev 1410)
@@ -67,7 +67,7 @@
aMaps: null,
layerRoot: null,
singleTile: true,
- bFractionalZoom: true, //TODO: set this in AppDef?
+ fractionalZoom: true, //TODO: set this in AppDef?
/**
* construct a new view Fusion.Widget.Map class.
@@ -562,29 +562,41 @@
zoom : function(fX, fY, nFactor) {
//do this differntly with OL code??
var extent = this.oMapOL.getExtent();
- var fDeltaX = extent.right - extent.left;
- var fDeltaY = extent.top - extent.bottom;
- var fMinX,fMaxX,fMinY,fMaxY;
- if (nFactor == 1 || nFactor == 0) {
- /*recenter*/
- fMinX = fX - (fDeltaX/2);
- fMaxX = fX + (fDeltaX/2);
- fMinY = fY - (fDeltaY/2);
- fMaxY = fY + (fDeltaY/2);
- } else if (nFactor > 0) {
- /*zoomin*/
- fMinX = fX - (fDeltaX/2 / nFactor);
- fMaxX = fX + (fDeltaX/2 / nFactor);
- fMinY = fY - (fDeltaY/2 / nFactor);
- fMaxY = fY + (fDeltaY/2 / nFactor);
- } else if (nFactor < 0) {
- /*zoomout*/
- fMinX = fX - ((fDeltaX/2) * Math.abs(nFactor));
- fMaxX = fX + ((fDeltaX/2) * Math.abs(nFactor));
- fMinY = fY - ((fDeltaY/2) * Math.abs(nFactor));
- fMaxY = fY + ((fDeltaY/2) * Math.abs(nFactor));
+ if (this.fractionalZoom) {
+ var fDeltaX = extent.right - extent.left;
+ var fDeltaY = extent.top - extent.bottom;
+ var fMinX,fMaxX,fMinY,fMaxY;
+ if (nFactor == 1 || nFactor == 0) {
+ /*recenter*/
+ fMinX = fX - (fDeltaX/2);
+ fMaxX = fX + (fDeltaX/2);
+ fMinY = fY - (fDeltaY/2);
+ fMaxY = fY + (fDeltaY/2);
+ } else if (nFactor > 0) {
+ /*zoomin*/
+ fMinX = fX - (fDeltaX/2 / nFactor);
+ fMaxX = fX + (fDeltaX/2 / nFactor);
+ fMinY = fY - (fDeltaY/2 / nFactor);
+ fMaxY = fY + (fDeltaY/2 / nFactor);
+ } else if (nFactor < 0) {
+ /*zoomout*/
+ fMinX = fX - ((fDeltaX/2) * Math.abs(nFactor));
+ fMaxX = fX + ((fDeltaX/2) * Math.abs(nFactor));
+ fMinY = fY - ((fDeltaY/2) * Math.abs(nFactor));
+ fMaxY = fY + ((fDeltaY/2) * Math.abs(nFactor));
+ }
+ this.setExtents(new OpenLayers.Bounds(fMinX, fMinY, fMaxX, fMaxY));
+ } else {
+ var currentZoomLevel = this.oMapOL.getZoom();
+ if (nFactor == 1 || nFactor == 0) {
+ this.oMapOL.panTo(new OpenLayers.LonLat(fX, fY));
+ } else if (nFactor > 1) {
+ this.oMapOL.zoomTo(currentZoomLevel+1);
+ } else if (nFactor < 1) {
+ this.oMapOL.zoomTo(currentZoomLevel-1);
+ }
}
- this.setExtents(new OpenLayers.Bounds(fMinX, fMinY, fMaxX, fMaxY));
+
},
zoomToScale: function(fScale) {
More information about the fusion-commits
mailing list