Browse Source

#295 Restore a tool when Space is released - fix for the first tool usage

tomaszkot 3 years ago
parent
commit
9dfdcdf109
1 changed files with 6 additions and 3 deletions
  1. 6 3
      PixiEditor/ViewModels/SubViewModels/Main/IoViewModel.cs

+ 6 - 3
PixiEditor/ViewModels/SubViewModels/Main/IoViewModel.cs

@@ -58,11 +58,14 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
 
 
         private void ProcessShortcutDown(bool isRepeat, Key key)
         private void ProcessShortcutDown(bool isRepeat, Key key)
         {
         {
-            if (isRepeat && !restoreToolOnKeyUp && Owner.ShortcutController.LastShortcut != null &&
-                Owner.ShortcutController.LastShortcut.Command == Owner.ToolsSubViewModel.SelectToolCommand)
+            var controller = Owner.ShortcutController;
+            if (!restoreToolOnKeyUp && 
+                (controller.LastShortcut == null || controller.LastShortcut.Command == Owner.ToolsSubViewModel.SelectToolCommand)
+               )
             {
             {
                 restoreToolOnKeyUp = true;
                 restoreToolOnKeyUp = true;
-                ShortcutController.BlockShortcutExecution = true;
+                if(isRepeat)
+                  ShortcutController.BlockShortcutExecution = true;
             }
             }
 
 
             Owner.ShortcutController.KeyPressed(key, Keyboard.Modifiers);
             Owner.ShortcutController.KeyPressed(key, Keyboard.Modifiers);