浏览代码

Fixed native menu again and open from clipboard

Krzysztof Krysiński 3 周之前
父节点
当前提交
27969e8cf6

+ 14 - 4
src/PixiEditor/Models/Commands/XAML/NativeMenu.cs

@@ -65,10 +65,20 @@ internal class NativeMenu : global::Avalonia.Controls.Menu
         {
             if (!ShortcutController.ShortcutExecutionBlocked)
             {
-                ViewModelMain.Current.ShortcutController.KeyPressed(
-                    false,
-                    command.Shortcut.Key,
-                    command.Shortcut.Modifiers);
+                if (command?.Shortcut != null && command.Shortcut.Gesture != null && command.Shortcut.Gesture.Key != Key.None || command.Shortcut.Gesture.KeyModifiers != KeyModifiers.None)
+                {
+                     ViewModelMain.Current.ShortcutController.KeyPressed(
+                         false,
+                         command.Shortcut.Key,
+                         command.Shortcut.Modifiers);
+                }
+                else
+                {
+                    if (iCommand.CanExecute(parameter))
+                    {
+                        iCommand.Execute(parameter);
+                    }
+                }
             }
             else
             {

+ 1 - 1
src/PixiEditor/ViewModels/SubViewModels/AnimationsViewModel.cs

@@ -189,7 +189,7 @@ internal class AnimationsViewModel : SubViewModel<ViewModelMain>
     {
         var activeDocument = Owner.DocumentManagerSubViewModel.ActiveDocument;
 
-        if (activeDocument is null)
+        if (activeDocument is null || info == default)
             return;
 
         if (!info.end)

+ 1 - 1
src/PixiEditor/ViewModels/SubViewModels/FileViewModel.cs

@@ -235,7 +235,7 @@ internal class FileViewModel : SubViewModel<ViewModelMain>
             {
                 if (File.Exists(dataImage.Name))
                 {
-                    OpenRegularImage(dataImage.Image, null);
+                    OpenRegularImage(dataImage.Image, dataImage.Name);
                     continue;
                 }