improve:白板翻页性能

This commit is contained in:
2026-02-22 14:12:26 +08:00
parent c06be8f502
commit 31fe3c858e
+7 -1
View File
@@ -331,10 +331,16 @@ namespace Ink_Canvas
var list = new List<TimeMachineHistory>(); var list = new List<TimeMachineHistory>();
if (fakeInkCanv.Strokes.Count > 0) if (fakeInkCanv.Strokes.Count > 0)
list.Add(new TimeMachineHistory(fakeInkCanv.Strokes.Clone(), TimeMachineHistoryType.UserInput, false)); list.Add(new TimeMachineHistory(fakeInkCanv.Strokes.Clone(), TimeMachineHistoryType.UserInput, false));
foreach (UIElement child in fakeInkCanv.Children) var childrenSnapshot = new List<UIElement>();
foreach (UIElement c in fakeInkCanv.Children)
childrenSnapshot.Add(c);
foreach (UIElement child in childrenSnapshot)
{ {
if (child is Image || child is MediaElement) if (child is Image || child is MediaElement)
{
list.Add(new TimeMachineHistory(child, TimeMachineHistoryType.ElementInsert)); list.Add(new TimeMachineHistory(child, TimeMachineHistoryType.ElementInsert));
fakeInkCanv.Children.Remove(child);
}
} }
return list.Count == 0 ? null : list.ToArray(); return list.Count == 0 ? null : list.ToArray();
} }