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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Dec 12 07:37:39 EST 2009


Author: christoph
Date: 2009-12-12 07:37:39 -0500 (Sat, 12 Dec 2009)
New Revision: 5164

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


Modified: trunk/mapbender/http/javascripts/mod_doubleclickZoom.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_doubleclickZoom.js	2009-12-12 12:36:05 UTC (rev 5163)
+++ trunk/mapbender/http/javascripts/mod_doubleclickZoom.js	2009-12-12 12:37:39 UTC (rev 5164)
@@ -41,13 +41,10 @@
 	
 			var mapObject = Mapbender.modules[currentTarget];
 			
-			//
-			// Zoom out on right double click
-			//
-			mapObject.doubleClickZoomOut = function (lastScrollPosition) {
+			var zoom = function (lastScrollPosition, zoomIn) {
 				var pos = mapObject.convertPixelToReal(lastScrollPosition);
 				var extentAfterZoom = this.calculateExtentAfterZoom(
-					false, 
+					zoomIn, 
 					2.0, 
 					pos.x, 
 					pos.y
@@ -57,22 +54,22 @@
 					lastScrollPosition,
 					extentAfterZoom
 				);
-				this.zoom(false, 1.0, posAfterZoom.x, posAfterZoom.y);
+				this.zoom(false, 1.0, newPos.x, newPos.y);
+				
 			};
 			
 			//
+			// Zoom out on right double click
+			//
+			mapObject.doubleClickZoomOut = function (lastScrollPosition) {
+				zoom(lastScrollPosition, false);
+			};
+			
+			//
 			// Zoom in on left double click
 			//
 			mapObject.doubleClickZoomIn = function (lastScrollPosition) {
-				var pos = mapObject.convertPixelToReal(lastScrollPosition);
-				this.zoom(true, 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);
-				this.zoom(false, 1.0, posAfterZoom.x, posAfterZoom.y);
+				zoom(lastScrollPosition, true);
 			};
 		
 			//



More information about the Mapbender_commits mailing list