Skip to content

Commit

Permalink
Flip works, but something is wrong with undo redo
Browse files Browse the repository at this point in the history
  • Loading branch information
flabbet committed Nov 10, 2021
1 parent 542f0e4 commit 843751c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 3 additions & 5 deletions PixiEditor/Models/DataHolders/Document/Document.Operations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PixiEditor.Helpers.Extensions;
using PixiEditor.Helpers.Extensions;
using PixiEditor.Models.Enums;
using PixiEditor.Models.Layers;
using PixiEditor.Models.Undo;
Expand Down Expand Up @@ -65,13 +65,12 @@ public void RotateActiveDocument(float degrees)
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}"));
Expand All @@ -85,7 +84,7 @@ private void FlipDocumentProcess(object[] processArgs)
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;

Expand Down Expand Up @@ -123,7 +122,6 @@ private void RotateDocumentProcess(object[] parameters)
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));
Expand Down
1 change: 1 addition & 0 deletions PixiEditor/PixiEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<WarningLevel>0</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
Expand Down
4 changes: 2 additions & 2 deletions PixiEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
// 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")]

0 comments on commit 843751c

Please sign in to comment.