Browse Source

Shift selection for group

flabbet 4 years ago
parent
commit
fc980ba961

+ 2 - 2
PixiEditor/Models/Layers/LayerStructure.cs

@@ -78,7 +78,7 @@ namespace PixiEditor.Models.Layers
         // idk if it works good for every scenario, there are too many scenarios to consider, that I won't ever bother test
         public GuidStructureItem AddNewGroup(string groupName, IEnumerable<Layer> layers)
         {
-            var topmostLayer = GetTopmostLayer(layers);
+            var topmostLayer = GetTopmostLayer(layers); // Test with bottom most
 
             var group = AddNewGroup(groupName, topmostLayer.LayerGuid);
 
@@ -95,7 +95,7 @@ namespace PixiEditor.Models.Layers
                     if (GetGroupLayers(sameLevelGroupParent).TrueForAll(x => x.IsActive))
                     {
                         Owner.MoveGroupInStructure(sameLevelGroupParent.GroupGuid, lastLayer);
-                        lastLayer = sameLevelGroupParent.EndLayerGuid; // Todo: Shift click on group, select other layers in between
+                        lastLayer = sameLevelGroupParent.StartLayerGuid; // Todo: fix if group is on top
                         continue;
                     }
                 }

+ 7 - 1
PixiEditor/Views/UserControls/Layers/LayerGroupControl.xaml.cs

@@ -245,8 +245,14 @@ namespace PixiEditor.Views.UserControls.Layers
             var layer = doc.Layers.First(x => x.LayerGuid == GroupData.EndLayerGuid);
             if (doc.ActiveLayerGuid != layer.LayerGuid)
             {
-                if(Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.LeftCtrl))
+                bool shiftDown = Keyboard.IsKeyDown(Key.LeftShift);
+                if (shiftDown || Keyboard.IsKeyDown(Key.LeftCtrl))
                 {
+                    if (shiftDown)
+                    {
+                        doc.SelectLayersRange(doc.Layers.IndexOf(layer));
+                    }
+
                     doc.LayerStructure.GetGroupLayers(GroupData).ForEach(x => x.IsActive = true);
                 }
                 else