improve:PPT墨迹加载

This commit is contained in:
2025-12-13 20:13:08 +08:00
parent 3cd26323dc
commit e792f2637d
+15 -11
View File
@@ -835,27 +835,26 @@ namespace Ink_Canvas
var previousSlide = _currentSlideShowPosition > 0 ? _currentSlideShowPosition : var previousSlide = _currentSlideShowPosition > 0 ? _currentSlideShowPosition :
(_pptManager?.GetCurrentSlideNumber() ?? 0); (_pptManager?.GetCurrentSlideNumber() ?? 0);
// 先保存当前页墨迹的副本 if (_isInkClearedByButton)
{
_isInkClearedByButton = false;
}
else
{
StrokeCollection strokesToSave = null; StrokeCollection strokesToSave = null;
if (previousSlide > 0 && previousSlide != currentSlide && inkCanvas.Strokes.Count > 0) if (previousSlide > 0 && previousSlide != currentSlide && inkCanvas.Strokes.Count > 0)
{ {
strokesToSave = inkCanvas.Strokes.Clone(); strokesToSave = inkCanvas.Strokes.Clone();
} }
if (_isInkClearedByButton) // 清除墨迹
{ if (inkCanvas.Strokes.Count > 0)
_isInkClearedByButton = false;
}
else if (inkCanvas.Strokes.Count > 0)
{ {
ClearStrokes(true); ClearStrokes(true);
timeMachine.ClearStrokeHistory(); timeMachine.ClearStrokeHistory();
} }
// 更新当前播放页码 // 异步保存之前页面的墨迹
_currentSlideShowPosition = currentSlide;
// 异步保存之前页面的墨迹(不阻塞翻页操作)
if (strokesToSave != null && previousSlide > 0 && previousSlide != currentSlide) if (strokesToSave != null && previousSlide > 0 && previousSlide != currentSlide)
{ {
Task.Run(() => Task.Run(() =>
@@ -877,7 +876,12 @@ namespace Ink_Canvas
} }
}); });
} }
LoadCurrentSlideInk(currentSlide, skipClear: true); // 跳过清除,因为已在上面清除 }
// 更新当前播放页码
_currentSlideShowPosition = currentSlide;
LoadCurrentSlideInk(currentSlide, skipClear: true);
_pptUIManager?.UpdateCurrentSlideNumber(currentSlide, totalSlides); _pptUIManager?.UpdateCurrentSlideNumber(currentSlide, totalSlides);
}); });