[mapguide-commits] r5832 - trunk/Tools/Maestro/Maestro.Editors/MapDefinition

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon May 23 08:39:07 EDT 2011


Author: jng
Date: 2011-05-23 05:39:07 -0700 (Mon, 23 May 2011)
New Revision: 5832

Modified:
   trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
Log:
#1631: Fix up the drag/drop reordering behavior of base map (tiled) layers


Modified: trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2011-05-23 12:15:19 UTC (rev 5831)
+++ trunk/Tools/Maestro/Maestro.Editors/MapDefinition/MapLayersSectionCtrl.cs	2011-05-23 12:39:07 UTC (rev 5832)
@@ -394,6 +394,13 @@
             RestoreSelection<BaseLayerItem>(trvBaseLayers, (tag) => { return tag.Tag == item.Tag; });
         }
 
+        private void RestoreBaseLayerSelection(IBaseMapLayer layer)
+        {
+            //The node tag will probably be different, but the wrapped
+            //instance is what we're checking for
+            RestoreSelection<BaseLayerItem>(trvBaseLayers, (tag) => { return tag.Tag == layer; });
+        }
+
         private void RestoreDrawOrderSelection(LayerItem layer)
         {
             //The node tag will probably be different, but the wrapped
@@ -982,9 +989,10 @@
                     IBaseMapLayer targetLayer = null;
                     IBaseMapGroup targetGroup = null;
                     var node = trvBaseLayers.GetNodeAt(trvBaseLayers.PointToClient(new Point(e.X, e.Y)));
+                    BaseLayerItem tli = null;
                     if (node != null)
                     {
-                        var tli = node.Tag as BaseLayerItem;
+                        tli = node.Tag as BaseLayerItem;
                         var tlg = node.Tag as BaseLayerGroupItem;
                         if (tli != null)
                             targetLayer = tli.Tag;
@@ -1008,6 +1016,10 @@
                                     srcGroup.InsertLayer(idx, sourceLayer);
 
                                     _tiledLayerModel.Invalidate();
+
+                                    //Keep group expanded
+                                    if (tli != null)
+                                        RestoreBaseLayerSelection(sourceLayer);
                                 }
                             }
                             else
@@ -1016,6 +1028,10 @@
                                 dstGroup.InsertLayer(0, targetLayer);
 
                                 _tiledLayerModel.Invalidate();
+
+                                //Keep group expanded
+                                if (tli != null)
+                                    RestoreBaseLayerSelection(targetLayer);
                             }
                         }
                     }



More information about the mapguide-commits mailing list