Browse Source

Fixed copy deselecting

Krzysztof Krysiński 1 week ago
parent
commit
c0906b80bb
1 changed files with 13 additions and 4 deletions
  1. 13 4
      src/PixiEditor/ViewModels/SubViewModels/ClipboardViewModel.cs

+ 13 - 4
src/PixiEditor/ViewModels/SubViewModels/ClipboardViewModel.cs

@@ -75,7 +75,8 @@ internal class ClipboardViewModel : SubViewModel<ViewModelMain>
             ? doc.TransformViewModel.Corners.AABBBounds
             ? doc.TransformViewModel.Corners.AABBBounds
             : null;
             : null;
 
 
-        await Copy();
+        doc.Operations.TryStopActiveExecutor();
+        await Copy(lastTransformRect);
         doc.Operations.DeleteSelectedPixels(doc.AnimationDataViewModel.ActiveFrameBindable, true, lastTransformRect);
         doc.Operations.DeleteSelectedPixels(doc.AnimationDataViewModel.ActiveFrameBindable, true, lastTransformRect);
     }
     }
 
 
@@ -349,9 +350,17 @@ internal class ClipboardViewModel : SubViewModel<ViewModelMain>
         if (doc is null)
         if (doc is null)
             return;
             return;
 
 
-        RectD? lastTransformRect = doc.TransformViewModel.TransformActive ?
-            doc.TransformViewModel.Corners.AABBBounds : null;
-        doc.Operations.TryStopActiveExecutor();
+        await ClipboardController.CopyToClipboard(doc, null);
+
+        SetHasImageInClipboard();
+    }
+
+    private async Task Copy(RectD? lastTransformRect)
+    {
+        var doc = Owner.DocumentManagerSubViewModel.ActiveDocument;
+        if (doc is null)
+            return;
+
         await ClipboardController.CopyToClipboard(doc, lastTransformRect);
         await ClipboardController.CopyToClipboard(doc, lastTransformRect);
 
 
         SetHasImageInClipboard();
         SetHasImageInClipboard();