Browse Source

Flip works, but something is wrong with undo redo

flabbet 3 years ago
parent
commit
843751c652

+ 3 - 5
PixiEditor/Models/DataHolders/Document/Document.Operations.cs

@@ -1,4 +1,4 @@
-using PixiEditor.Helpers.Extensions;
+using PixiEditor.Helpers.Extensions;
 using PixiEditor.Models.Enums;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Undo;
@@ -65,13 +65,12 @@ namespace PixiEditor.Models.DataHolders
         public void FlipActiveDocument(FlipType flip)
         {
             object[] processArgs = { flip };
-            object[] reverseProcessArgs = { flip == FlipType.Horizontal ? FlipType.Vertical : FlipType.Horizontal };
 
             FlipDocumentProcess(processArgs);
 
             UndoManager.AddUndoChange(new Change(
                 FlipDocumentProcess,
-                reverseProcessArgs,
+                processArgs,
                 FlipDocumentProcess,
                 processArgs,
                 $"Flip layer: {flip}"));
@@ -85,7 +84,7 @@ namespace PixiEditor.Models.DataHolders
                 using (new SKAutoCanvasRestore(layer.LayerBitmap.SkiaSurface.Canvas, true))
                 {
                     var copy = layer.LayerBitmap.SkiaSurface.Snapshot();
-                    layer.LayerBitmap.SkiaSurface.Canvas.Clear();
+                    layer.CreateNewBitmap(layer.Width + horizontalModifier, 
 
                     var canvas = layer.LayerBitmap.SkiaSurface.Canvas;
 
@@ -123,7 +122,6 @@ namespace PixiEditor.Models.DataHolders
                 using (new SKAutoCanvasRestore(layer.LayerBitmap.SkiaSurface.Canvas, true))
                 {
                     var copy = layer.LayerBitmap.SkiaSurface.Snapshot();
-                    layer.LayerBitmap.SkiaSurface.Canvas.Clear();
 
                     double radians = Math.PI * degrees / 180;
                     float sine = (float)Math.Abs(Math.Sin(radians));

+ 1 - 0
PixiEditor/PixiEditor.csproj

@@ -68,6 +68,7 @@
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DebugType>full</DebugType>
     <DebugSymbols>true</DebugSymbols>
+    <WarningLevel>0</WarningLevel>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">

+ 2 - 2
PixiEditor/Properties/AssemblyInfo.cs

@@ -50,5 +50,5 @@ using System.Windows;
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.6.0")]
-[assembly: AssemblyFileVersion("0.1.6.0")]
+[assembly: AssemblyVersion("0.1.7.0")]
+[assembly: AssemblyFileVersion("0.1.7.0")]