Explorar el Código

Fixed filter commands not in keybindings and moved invert selection command

CPKreuz hace 2 años
padre
commit
321b2b6c56

+ 16 - 9
src/PixiEditor/Models/Commands/CommandController.cs

@@ -239,16 +239,23 @@ internal class CommandController
 
                         if (hasFilter)
                             continue;
+
+                        var command =
+                            new Command.BasicCommand(
+                                _ => ViewModelMain.Current.SearchSubViewModel.OpenSearchWindow($":{searchTerm}:"),
+                                CanExecuteEvaluator.AlwaysTrue)
+                            {
+                                InternalName = menu.InternalName,
+                                DisplayName = menu.DisplayName,
+                                Description = string.Empty,
+                                IconEvaluator = IconEvaluator.Default,
+                                DefaultShortcut = menu.GetShortcut(),
+                                Shortcut = GetShortcut(name, attribute.GetShortcut(), template)
+                            };
                         
-                        Commands.Add(new Command.BasicCommand(_ => ViewModelMain.Current.SearchSubViewModel.OpenSearchWindow($":{searchTerm}:"), CanExecuteEvaluator.AlwaysTrue)
-                        {
-                            InternalName = menu.InternalName,
-                            DisplayName = menu.DisplayName,
-                            Description = string.Empty,
-                            IconEvaluator = IconEvaluator.Default,
-                            DefaultShortcut = menu.GetShortcut(),
-                            Shortcut = GetShortcut(name, attribute.GetShortcut(), template)
-                        });
+                        Commands.Add(command);
+
+                        AddCommandToCommandsCollection(command, commandGroupsData, commands);
                     }
                 }
             }

+ 6 - 6
src/PixiEditor/ViewModels/SubViewModels/Main/SelectionViewModel.cs

@@ -31,6 +31,12 @@ internal class SelectionViewModel : SubViewModel<ViewModelMain>
         doc.Operations.ClearSelection();
     }
 
+    [Command.Basic("PixiEditor.Selection.InvertSelection", "Invert selection", "Invert the selected area", CanExecute = "PixiEditor.Selection.IsNotEmpty", Key = Key.I, Modifiers = ModifierKeys.Control)]
+    public void InvertSelection()
+    {
+        Owner.DocumentManagerSubViewModel.ActiveDocument?.Operations.InvertSelection();
+    }
+
     [Evaluator.CanExecute("PixiEditor.Selection.IsNotEmpty")]
     public bool SelectionIsNotEmpty()
     {
@@ -69,12 +75,6 @@ internal class SelectionViewModel : SubViewModel<ViewModelMain>
         Owner.DocumentManagerSubViewModel.ActiveDocument?.Operations.SelectionToMask(mode);
     }
 
-    [Command.Basic("PixiEditor.Selection.InvertSelection", "Invert selection", "Invert the selected area", CanExecute = "PixiEditor.Selection.IsNotEmpty", Key = Key.I, Modifiers = ModifierKeys.Control)]
-    public void InvertSelection()
-    {
-        Owner.DocumentManagerSubViewModel.ActiveDocument?.Operations.InvertSelection();
-    }
-    
     [Evaluator.CanExecute("PixiEditor.Selection.CanNudgeSelectedObject")]
     public bool CanNudgeSelectedObject(int[] dist) => Owner.DocumentManagerSubViewModel.ActiveDocument?.UpdateableChangeActive == true;
 }