[BugFix] 修复部分情况下无法正确还原EraseByPoint记录的Bug

This commit is contained in:
Raspberry-Monster 2023-06-06 11:49:58 +08:00
parent 8f8a6e5f12
commit 93d1c116b3
No known key found for this signature in database
GPG Key ID: 9A0D725BB122D507

View File

@ -5449,6 +5449,36 @@ namespace Ink_Canvas
} }
} }
} }
else if (item.CommitType == TimeMachineHistoryType.Rotate)
{
if (item.StrokeHasBeenCleared)
{
foreach (var strokes in item.CurrentStroke)
{
if (inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Remove(strokes);
}
foreach (var strokes in item.ReplacedStroke)
{
if (!inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Add(strokes);
}
}
else
{
foreach (var strokes in item.CurrentStroke)
{
if (!inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Add(strokes);
}
foreach (var strokes in item.ReplacedStroke)
{
if (inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Remove(strokes);
}
}
}
else if (item.CommitType == TimeMachineHistoryType.Clear) else if (item.CommitType == TimeMachineHistoryType.Clear)
{ {
if (!item.StrokeHasBeenCleared) if (!item.StrokeHasBeenCleared)
@ -5472,13 +5502,6 @@ namespace Ink_Canvas
} }
else else
{ {
if (item.CurrentStroke != null)
{
foreach (var currentStroke in item.CurrentStroke)
{
if (inkCanvas.Strokes.Contains(currentStroke)) inkCanvas.Strokes.Remove(currentStroke);
}
}
if (item.ReplacedStroke != null) if (item.ReplacedStroke != null)
{ {
foreach (var replacedStroke in item.ReplacedStroke) foreach (var replacedStroke in item.ReplacedStroke)
@ -5486,11 +5509,18 @@ namespace Ink_Canvas
if (!inkCanvas.Strokes.Contains(replacedStroke)) inkCanvas.Strokes.Add(replacedStroke); if (!inkCanvas.Strokes.Contains(replacedStroke)) inkCanvas.Strokes.Add(replacedStroke);
} }
} }
if (item.CurrentStroke != null)
{
foreach (var currentStroke in item.CurrentStroke)
{
if (inkCanvas.Strokes.Contains(currentStroke)) inkCanvas.Strokes.Remove(currentStroke);
}
} }
} }
} }
_currentCommitType = CommitReason.UserInput; _currentCommitType = CommitReason.UserInput;
} }
}
else else
{ {
_currentCommitType = CommitReason.CodeInput; _currentCommitType = CommitReason.CodeInput;
@ -5546,6 +5576,36 @@ namespace Ink_Canvas
} }
} }
} }
else if (item.CommitType == TimeMachineHistoryType.Rotate)
{
if (item.StrokeHasBeenCleared)
{
foreach (var strokes in item.CurrentStroke)
{
if (inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Remove(strokes);
}
foreach (var strokes in item.ReplacedStroke)
{
if (!inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Add(strokes);
}
}
else
{
foreach (var strokes in item.CurrentStroke)
{
if (!inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Add(strokes);
}
foreach (var strokes in item.ReplacedStroke)
{
if (inkCanvas.Strokes.Contains(strokes))
inkCanvas.Strokes.Remove(strokes);
}
}
}
else if (item.CommitType == TimeMachineHistoryType.Clear) else if (item.CommitType == TimeMachineHistoryType.Clear)
{ {
if (!item.StrokeHasBeenCleared) if (!item.StrokeHasBeenCleared)
@ -5569,13 +5629,6 @@ namespace Ink_Canvas
} }
else else
{ {
if (item.CurrentStroke != null)
{
foreach (var currentStroke in item.CurrentStroke)
{
if (inkCanvas.Strokes.Contains(currentStroke)) inkCanvas.Strokes.Remove(currentStroke);
}
}
if (item.ReplacedStroke != null) if (item.ReplacedStroke != null)
{ {
foreach (var replacedStroke in item.ReplacedStroke) foreach (var replacedStroke in item.ReplacedStroke)
@ -5583,9 +5636,15 @@ namespace Ink_Canvas
if (!inkCanvas.Strokes.Contains(replacedStroke)) inkCanvas.Strokes.Add(replacedStroke); if (!inkCanvas.Strokes.Contains(replacedStroke)) inkCanvas.Strokes.Add(replacedStroke);
} }
} }
if (item.CurrentStroke != null)
{
foreach (var currentStroke in item.CurrentStroke)
{
if (inkCanvas.Strokes.Contains(currentStroke)) inkCanvas.Strokes.Remove(currentStroke);
}
}
} }
} }
} }
_currentCommitType = CommitReason.UserInput; _currentCommitType = CommitReason.UserInput;
} }