[mapguide-commits] r7116 - trunk/MgDev/Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Oct 15 23:13:51 PDT 2012


Author: jng
Date: 2012-10-15 23:13:50 -0700 (Mon, 15 Oct 2012)
New Revision: 7116

Modified:
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
#2145: Allow the zoom rectangle tool in the AJAX viewer to zoom in on click (without tracing a rectangle). Patch by Bruno Scott.

Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2012-10-16 06:09:03 UTC (rev 7115)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2012-10-16 06:13:50 UTC (rev 7116)
@@ -2884,17 +2884,22 @@
     if(tool == 3)
     {
         if((x2 - x1 <= 2) && (y2 - y1 <= 2))
-            return;
+        {
+            // use ZoomIn function if the user clicks on map
+            ZoomIn(x1, y1);
+        }
+        else
+        {
+            pt1 = ScreenToMapUnits(x1, y1);
+            pt2 = ScreenToMapUnits(x2, y2);
 
-        pt1 = ScreenToMapUnits(x1, y1);
-        pt2 = ScreenToMapUnits(x2, y2);
-
-        mcsW = Math.abs(pt2.X - pt1.X);
-        mcsH = Math.abs(pt2.Y - pt1.Y);
-        scale = CalculateScale1(mcsW, mcsH, mapDevW, mapDevH);
-        scale = finscale? GetNearestFiniteScale(scale): NormalizeScale(scale);
-        HideMapImage();
-        GotoView(pt1.X + (pt2.X - pt1.X)/2, pt1.Y + (pt2.Y - pt1.Y)/2, scale, true, false);
+            mcsW = Math.abs(pt2.X - pt1.X);
+            mcsH = Math.abs(pt2.Y - pt1.Y);
+            scale = CalculateScale1(mcsW, mcsH, mapDevW, mapDevH);
+            scale = finscale? GetNearestFiniteScale(scale): NormalizeScale(scale);
+            HideMapImage();
+            GotoView(pt1.X + (pt2.X - pt1.X)/2, pt1.Y + (pt2.Y - pt1.Y)/2, scale, true, false);
+        }
     }
     else if(tool == 0)
     {



More information about the mapguide-commits mailing list