[Mapbender-commits] r5162 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Dec 12 07:32:30 EST 2009


Author: christoph
Date: 2009-12-12 07:32:30 -0500 (Sat, 12 Dec 2009)
New Revision: 5162

Modified:
   trunk/mapbender/http/javascripts/map_obj.js
   trunk/mapbender/http/javascripts/mod_doubleclickZoom.js
Log:


Modified: trunk/mapbender/http/javascripts/map_obj.js
===================================================================
--- trunk/mapbender/http/javascripts/map_obj.js	2009-12-12 12:30:41 UTC (rev 5161)
+++ trunk/mapbender/http/javascripts/map_obj.js	2009-12-12 12:32:30 UTC (rev 5162)
@@ -566,7 +566,7 @@
         }
     };
     
-	var calculateExtentAfterZoom = function (in_, factor, x, y) {
+	this.calculateExtentAfterZoom = function (in_, factor, x, y) {
         factor = parseFloat(factor);
         if (!in_) {
             factor = 1 / factor;
@@ -633,7 +633,7 @@
      * @param {float} y center to y-position
      */
     this.zoom = function(in_, factor, x, y){
-        this.setExtent(calculateExtentAfterZoom(in_, factor, x, y));
+        this.setExtent(this.calculateExtentAfterZoom(in_, factor, x, y));
         this.setMapRequest();
     };
     
@@ -642,8 +642,13 @@
         Math.log(10))));
     };
     
-    this.convertPixelToReal = function(aPoint){
-        var arrayBBox = this.getExtent().split(",");
+    this.convertPixelToReal = function(aPoint, referenceExtent){
+    	if (arguments.length === 2) {
+    		var arrayBBox = referenceExtent.toString().split(",");
+    	}
+    	else {
+	        var arrayBBox = this.getExtent().split(",");
+    	}
         var minX = parseFloat(arrayBBox[0]);
         var minY = parseFloat(arrayBBox[1]);
         var maxX = parseFloat(arrayBBox[2]);
@@ -994,7 +999,7 @@
 /*
 				if (doAnimation && currentWms.gui_wms_visible === 2) {
 					// request larger background image
-					var bgExtent = calculateExtentAfterZoom(false, 2.0, that.extent.center.x, that.extent.center.y);
+					var bgExtent = this.calculateExtentAfterZoom(false, 2.0, that.extent.center.x, that.extent.center.y);
 //					console.log(bgExtent);
 					var bgSwPix = that.convertRealToPixel(bgExtent.min);
 					var bgNePix = that.convertRealToPixel(bgExtent.max);

Modified: trunk/mapbender/http/javascripts/mod_doubleclickZoom.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_doubleclickZoom.js	2009-12-12 12:30:41 UTC (rev 5161)
+++ trunk/mapbender/http/javascripts/mod_doubleclickZoom.js	2009-12-12 12:32:30 UTC (rev 5162)
@@ -46,13 +46,17 @@
 			//
 			mapObject.doubleClickZoomOut = function (lastScrollPosition) {
 				var pos = mapObject.convertPixelToReal(lastScrollPosition);
-				this.zoom(false, 2.0, pos.x, pos.y);
+				var extentAfterZoom = this.calculateExtentAfterZoom(
+					false, 
+					2.0, 
+					pos.x, 
+					pos.y
+				);
 		
-				var newPos = new Point();
-				newPos.x = this.width - lastScrollPosition.x;
-				newPos.y = this.height - lastScrollPosition.y;
-						
-				var posAfterZoom = this.convertPixelToReal(newPos);
+				var newPos = mapObject.convertPixelToReal(
+					lastScrollPosition,
+					extentAfterZoom
+				);
 				this.zoom(false, 1.0, posAfterZoom.x, posAfterZoom.y);
 			};
 			



More information about the Mapbender_commits mailing list