From 9abce332573aa7ce5da63499c21c514056e6750a Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 10 Jan 2026 17:28:14 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"improve:PPT=E5=A2=A8=E8=BF=B9?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e792f2637d5177c3ca9091d1ed2d91eb5cafc94c. --- Ink Canvas/MainWindow_cs/MW_PPT.cs | 70 ++++++++++++------------- Ink Canvas/MainWindow_cs/MW_Settings.cs | 7 --- 2 files changed, 33 insertions(+), 44 deletions(-) diff --git a/Ink Canvas/MainWindow_cs/MW_PPT.cs b/Ink Canvas/MainWindow_cs/MW_PPT.cs index 7257b93d..a4cf2105 100644 --- a/Ink Canvas/MainWindow_cs/MW_PPT.cs +++ b/Ink Canvas/MainWindow_cs/MW_PPT.cs @@ -807,53 +807,49 @@ namespace Ink_Canvas var previousSlide = _currentSlideShowPosition > 0 ? _currentSlideShowPosition : (_pptManager?.GetCurrentSlideNumber() ?? 0); + // 先保存当前页墨迹的副本 + StrokeCollection strokesToSave = null; + if (previousSlide > 0 && previousSlide != currentSlide && inkCanvas.Strokes.Count > 0) + { + strokesToSave = inkCanvas.Strokes.Clone(); + } + if (_isInkClearedByButton) { _isInkClearedByButton = false; } - else + else if (inkCanvas.Strokes.Count > 0) { - StrokeCollection strokesToSave = null; - if (previousSlide > 0 && previousSlide != currentSlide && inkCanvas.Strokes.Count > 0) - { - strokesToSave = inkCanvas.Strokes.Clone(); - } - - // 清除墨迹 - if (inkCanvas.Strokes.Count > 0) - { - ClearStrokes(true); - timeMachine.ClearStrokeHistory(); - } - - // 异步保存之前页面的墨迹 - if (strokesToSave != null && previousSlide > 0 && previousSlide != currentSlide) - { - Task.Run(() => - { - try - { - Application.Current.Dispatcher.Invoke(() => - { - bool canWrite = _singlePPTInkManager?.CanWriteInk(previousSlide) == true; - if (canWrite) - { - _singlePPTInkManager?.SaveCurrentSlideStrokes(previousSlide, strokesToSave); - } - }); - } - catch (Exception ex) - { - LogHelper.WriteLogToFile($"异步保存PPT页面墨迹失败: {ex}", LogHelper.LogType.Error); - } - }); - } + ClearStrokes(true); + timeMachine.ClearStrokeHistory(); } // 更新当前播放页码 _currentSlideShowPosition = currentSlide; - LoadCurrentSlideInk(currentSlide, skipClear: true); + // 异步保存之前页面的墨迹(不阻塞翻页操作) + if (strokesToSave != null && previousSlide > 0 && previousSlide != currentSlide) + { + Task.Run(() => + { + try + { + Application.Current.Dispatcher.Invoke(() => + { + bool canWrite = _singlePPTInkManager?.CanWriteInk(previousSlide) == true; + if (canWrite) + { + _singlePPTInkManager?.SaveCurrentSlideStrokes(previousSlide, strokesToSave); + } + }); + } + catch (Exception ex) + { + LogHelper.WriteLogToFile($"异步保存PPT页面墨迹失败: {ex}", LogHelper.LogType.Error); + } + }); + } + LoadCurrentSlideInk(currentSlide, skipClear: true); // 跳过清除,因为已在上面清除 _pptUIManager?.UpdateCurrentSlideNumber(currentSlide, totalSlides); }); diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index a9644fdf..47a3c474 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -671,13 +671,6 @@ namespace Ink_Canvas SaveSettingsToFile(); } - private void ToggleSwitchSkipAnimationsWhenGoNext_OnToggled(object sender, RoutedEventArgs e) - { - if (!isLoaded) return; - Settings.PowerPointSettings.SkipAnimationsWhenGoNext = ToggleSwitchSkipAnimationsWhenGoNext.IsOn; - SaveSettingsToFile(); - } - private void PPTLSButtonOpacityValueSlider_ValueChanged(object sender, RoutedEventArgs e) { if (!isLoaded) return;