[fusion-commits] r1343 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Mar 27 09:38:40 EDT 2008


Author: zjames
Date: 2008-03-27 09:38:40 -0400 (Thu, 27 Mar 2008)
New Revision: 1343

Modified:
   trunk/widgets/MapMenu.js
Log:
Re #40, preserve extents on map switch

Modified: trunk/widgets/MapMenu.js
===================================================================
--- trunk/widgets/MapMenu.js	2008-03-26 17:44:27 UTC (rev 1342)
+++ trunk/widgets/MapMenu.js	2008-03-27 13:38:40 UTC (rev 1343)
@@ -93,6 +93,10 @@
                             'type': this.arch,
                             'extension':{'ResourceId': [mapNode.getNodeText('ResourceId')]}
                            }]};
+                //set up needed accessor
+                data.getInitialView = function() {
+                    return this.initialView;
+                };
                 var action = new Jx.Action(this.switchMap.bind(this, data));
                 var menuItem = new Jx.MenuItem(action,opt);
                 
@@ -133,7 +137,14 @@
         this.oMenu.show();
     },
         
+    //change the map, preserving current extents
     switchMap: function(data) {
+        var ce = this.getMap().getCurrentExtents();
+        data.initialView = {minX:ce.left,
+                            minY:ce.bottom,
+                            maxX:ce.right,
+                            maxY:ce.top
+                            };        
         this.getMap().loadMapGroup(data);
     }
 };
\ No newline at end of file



More information about the fusion-commits mailing list