Skip to content

Commit

Permalink
[fix] undefined about StrokeManipulationHistory, ElementsManipulation…
Browse files Browse the repository at this point in the history
…History
  • Loading branch information
ChangSakura committed Aug 11, 2024
1 parent 4f2f4bf commit dac62ac
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
18 changes: 12 additions & 6 deletions Ink Canvas/MainWindow_cs/MW_SelectionGestures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,16 +529,22 @@ private void GridInkCanvasSelectionCover_ManipulationCompleted(object sender, Ma
if (StrokeManipulationHistory?.Count > 0 || ElementsManipulationHistory?.Count > 0)
{
timeMachine.CommitStrokeManipulationHistory(StrokeManipulationHistory, ElementsManipulationHistory);
foreach (var item in StrokeManipulationHistory)
if(StrokeManipulationHistory?.Count > 0)
{
StrokeInitialHistory[item.Key] = item.Value.Item2;
foreach (var item in StrokeManipulationHistory)
{
StrokeInitialHistory[item.Key] = item.Value.Item2;
}
StrokeManipulationHistory = null;
}
StrokeManipulationHistory = null;
foreach (var item in ElementsManipulationHistory)
if(ElementsManipulationHistory?.Count > 0)
{
ElementsInitialHistory[item.Key] = item.Value.Item2;
foreach (var item in ElementsManipulationHistory)
{
ElementsInitialHistory[item.Key] = item.Value.Item2;
}
ElementsManipulationHistory = null;
}
ElementsManipulationHistory = null;
}
if (DrawingAttributesHistory.Count > 0)
{
Expand Down
18 changes: 12 additions & 6 deletions Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1615,16 +1615,22 @@ private void inkCanvas_MouseUp(object sender, MouseButtonEventArgs e)
if (StrokeManipulationHistory?.Count > 0 || ElementsManipulationHistory?.Count > 0)
{
timeMachine.CommitStrokeManipulationHistory(StrokeManipulationHistory, ElementsManipulationHistory);
foreach (var item in StrokeManipulationHistory)
if(StrokeManipulationHistory?.Count > 0)
{
StrokeInitialHistory[item.Key] = item.Value.Item2;
foreach (var item in StrokeManipulationHistory)
{
StrokeInitialHistory[item.Key] = item.Value.Item2;
}
StrokeManipulationHistory = null;
}
StrokeManipulationHistory = null;
foreach (var item in ElementsManipulationHistory)
if (ElementsManipulationHistory?.Count > 0)
{
ElementsInitialHistory[item.Key] = item.Value.Item2;
foreach (var item in ElementsManipulationHistory)
{
ElementsInitialHistory[item.Key] = item.Value.Item2;
}
ElementsManipulationHistory = null;
}
ElementsManipulationHistory = null;
}
if (DrawingAttributesHistory.Count > 0)
{
Expand Down
25 changes: 14 additions & 11 deletions Ink Canvas/MainWindow_cs/MW_TimeMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,22 +404,25 @@ private void ToCommitStrokeManipulationHistoryAfterMouseUp()
{
return;
}
timeMachine.CommitStrokeManipulationHistory(StrokeManipulationHistory, ElementsManipulationHistory);
if (StrokeManipulationHistory != null)
if(StrokeManipulationHistory?.Count > 0 || ElementsManipulationHistory?.Count > 0)
{
foreach (var item in StrokeManipulationHistory)
timeMachine.CommitStrokeManipulationHistory(StrokeManipulationHistory, ElementsManipulationHistory);
if (StrokeManipulationHistory != null)
{
StrokeInitialHistory[item.Key] = item.Value.Item2;
foreach (var item in StrokeManipulationHistory)
{
StrokeInitialHistory[item.Key] = item.Value.Item2;
}
StrokeManipulationHistory = null;
}
StrokeManipulationHistory = null;
}
if (ElementsManipulationHistory != null)
{
foreach (var item in ElementsManipulationHistory)
if (ElementsManipulationHistory != null)
{
ElementsInitialHistory[item.Key] = item.Value.Item2;
foreach (var item in ElementsManipulationHistory)
{
ElementsInitialHistory[item.Key] = item.Value.Item2;
}
ElementsManipulationHistory = null;
}
ElementsManipulationHistory = null;
}
}
}
Expand Down

0 comments on commit dac62ac

Please sign in to comment.