Browse Source

ShortcutBox context aware

flabbet 1 year ago
parent
commit
cc2434c5cb
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/PixiEditor.AvaloniaUI/Views/Shortcuts/ShortcutBox.cs

+ 2 - 1
src/PixiEditor.AvaloniaUI/Views/Shortcuts/ShortcutBox.cs

@@ -55,7 +55,8 @@ internal class ShortcutBox : ContentControl
 
         if (e != KeyCombination.None)
         {
-            if (controller.Commands[e].SkipWhile(x => x == Command).FirstOrDefault() is { } oldCommand)
+            if (controller.Commands[e].Where(x => x.ShortcutContext == null || x.ShortcutContext == Command.ShortcutContext)
+                    .SkipWhile(x => x == Command).FirstOrDefault() is { } oldCommand)
             {
                 var oldShortcut = Command.Shortcut;
                 bool enableSwap = oldShortcut is not { Key: Key.None, Modifiers: KeyModifiers.None };