浏览代码

Fixed copy losing precision

flabbet 9 月之前
父节点
当前提交
ff0178eda3
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      src/PixiEditor/Models/Controllers/ClipboardController.cs

+ 8 - 5
src/PixiEditor/Models/Controllers/ClipboardController.cs

@@ -63,7 +63,7 @@ internal static class ClipboardController
         DataObject data = new DataObject();
 
         Surface surfaceToCopy = null;
-        RectI copyArea = RectI.Empty;
+        RectD copyArea = RectD.Empty;
 
         if (!document.SelectionPathBindable.IsEmpty)
         {
@@ -77,7 +77,8 @@ internal static class ClipboardController
                 return;
             }
 
-            (surfaceToCopy, copyArea) = surface.AsT2;
+            surfaceToCopy = surface.AsT2.Item1;
+            copyArea = (RectD)surface.AsT2.Item2;
         }
         else if (document.TransformViewModel.TransformActive)
         {
@@ -87,7 +88,8 @@ internal static class ClipboardController
             if (surface.IsT0 || surface.IsT1)
                 return;
 
-            (surfaceToCopy, copyArea) = surface.AsT2;
+            surfaceToCopy = surface.AsT2.Item1;
+            copyArea = document.TransformViewModel.Corners.AABBBounds;
         }
         else if (document.SelectedStructureMember != null)
         {
@@ -97,7 +99,8 @@ internal static class ClipboardController
             if (surface.IsT0 || surface.IsT1)
                 return;
 
-            (surfaceToCopy, copyArea) = surface.AsT2;
+            surfaceToCopy = surface.AsT2.Item1;
+            copyArea = (RectD)bounds;
         }
 
         if (surfaceToCopy == null)
@@ -107,7 +110,7 @@ internal static class ClipboardController
 
         await AddImageToClipboard(surfaceToCopy, data);
 
-        if (copyArea.Size != document.SizeBindable && copyArea.Pos != VecI.Zero && copyArea != RectI.Empty)
+        if (copyArea.Size != document.SizeBindable && copyArea.Pos != VecI.Zero && copyArea != RectD.Empty)
         {
             data.SetVecD(ClipboardDataFormats.PositionFormat, copyArea.Pos);
         }