[fusion-commits] r1412 - in trunk: MapGuide lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon May 26 14:52:23 EDT 2008
Author: madair
Date: 2008-05-26 14:52:23 -0400 (Mon, 26 May 2008)
New Revision: 1412
Modified:
trunk/MapGuide/MapGuide.js
trunk/lib/Map.js
Log:
re #63: further refactoring of map.zoom() method
Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js 2008-05-26 18:50:35 UTC (rev 1411)
+++ trunk/MapGuide/MapGuide.js 2008-05-26 18:52:23 UTC (rev 1412)
@@ -469,7 +469,7 @@
*
* Returns an OpenLayers MapGuide layer object
*/
- createOLLayer: function(layerName, bIsBaseLayer, bSingleTile, bFractionalZoom) {
+ createOLLayer: function(layerName, bIsBaseLayer, bSingleTile) {
var layerOptions = {
units : this.units,
isBaseLayer : bIsBaseLayer,
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2008-05-26 18:50:35 UTC (rev 1411)
+++ trunk/lib/Map.js 2008-05-26 18:52:23 UTC (rev 1412)
@@ -87,13 +87,13 @@
}
if (widgetTag.extension.FractionalZoom) {
- this.bFractionalZoom = widgetTag.extension.FractionalZoom[0]=='false'?false:true;
+ this.fractionalZoom = widgetTag.extension.FractionalZoom[0]=='false'?false:true;
}
var scalesArray = null;
if (widgetTag.extension.Scales) {
scalesArray = widgetTag.extension.Scales[0].split(',');
- this.bFractionalZoom = false;
+ this.fractionalZoom = false;
}
OpenLayers.DOTS_PER_INCH = this._nDpi;
@@ -102,7 +102,7 @@
controls: [],
fallThrough: true,
scales: scalesArray,
- fractionalZoom: this.bFractionalZoom
+ fractionalZoom: this.fractionalZoom
};
if (widgetTag.extension.ConstrainMapExtent) {
this.bRestrictExtent = widgetTag.extension.ConstrainMapExtent[0]=='true'?true:false;
@@ -561,42 +561,38 @@
zoom : function(fX, fY, nFactor) {
//do this differntly with OL code??
- var extent = this.oMapOL.getExtent();
- 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));
+ if (nFactor == 1 || nFactor == 0) {
+ /*recenter*/
+ this.oMapOL.panTo(new OpenLayers.LonLat(fX, fY));
} 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);
+ var extent = this.oMapOL.getExtent();
+ if (this.fractionalZoom) {
+ var fDeltaX = extent.right - extent.left;
+ var fDeltaY = extent.top - extent.bottom;
+ var fMinX,fMaxX,fMinY,fMaxY;
+ 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) {
+ this.oMapOL.zoomTo(currentZoomLevel+1);
+ } else if (nFactor < 1) {
+ this.oMapOL.zoomTo(currentZoomLevel-1);
+ }
}
- }
-
+ }
},
zoomToScale: function(fScale) {
More information about the fusion-commits
mailing list