improve:PPT墨迹管理

This commit is contained in:
2025-10-18 17:24:47 +08:00
parent 88a7cce269
commit c3885c170c
2 changed files with 10 additions and 23 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ namespace Ink_Canvas.Helpers
} }
/// <summary> /// <summary>
/// 强制保存指定页面的墨迹(忽略锁定状态) /// 强制保存指定页面的墨迹
/// </summary> /// </summary>
public void ForceSaveSlideStrokes(int slideIndex, StrokeCollection strokes) public void ForceSaveSlideStrokes(int slideIndex, StrokeCollection strokes)
{ {
+9 -22
View File
@@ -77,7 +77,7 @@ namespace Ink_Canvas
#region PPT State Management #region PPT State Management
private bool wasFloatingBarFoldedWhenEnterSlideShow; private bool wasFloatingBarFoldedWhenEnterSlideShow;
private bool isEnteredSlideShowEndEvent; //防止重复调用本函数导致墨迹保存失效 private bool isEnteredSlideShowEndEvent;
private bool isPresentationHaveBlackSpace; private bool isPresentationHaveBlackSpace;
// 长按翻页相关字段 // 长按翻页相关字段
@@ -107,7 +107,7 @@ namespace Ink_Canvas
private PPTUIManager _pptUIManager; private PPTUIManager _pptUIManager;
/// <summary> /// <summary>
/// 获取PPT管理器实例(供UI管理器使用) /// 获取PPT管理器实例
/// </summary> /// </summary>
public PPTManager PPTManager => _pptManager; public PPTManager PPTManager => _pptManager;
#endregion #endregion
@@ -615,7 +615,7 @@ namespace Ink_Canvas
} }
} }
private async void OnPPTSlideShowBegin(SlideShowWindow wn) private void OnPPTSlideShowBegin(SlideShowWindow wn)
{ {
try try
{ {
@@ -629,16 +629,15 @@ namespace Ink_Canvas
} }
else else
{ {
// 如果关闭了PPT自动收纳功能,但用户当前在收纳模式下,进入PPT时取消收纳以提供更好的使用体验
if (isFloatingBarFolded) if (isFloatingBarFolded)
{ {
await UnFoldFloatingBar(new object()); UnFoldFloatingBar(new object());
} }
} }
isStopInkReplay = true; isStopInkReplay = true;
await Application.Current.Dispatcher.InvokeAsync(() => Application.Current.Dispatcher.Invoke(() =>
{ {
// 获取当前活跃的演示文稿并切换到对应的墨迹管理器 // 获取当前活跃的演示文稿并切换到对应的墨迹管理器
var activePresentation = _pptManager?.GetCurrentActivePresentation(); var activePresentation = _pptManager?.GetCurrentActivePresentation();
@@ -753,14 +752,7 @@ namespace Ink_Canvas
if (!isFloatingBarFolded) if (!isFloatingBarFolded)
{ {
new Thread(() => ViewboxFloatingBarMarginAnimation(60);
{
Thread.Sleep(100);
Application.Current.Dispatcher.Invoke(() =>
{
ViewboxFloatingBarMarginAnimation(60);
});
}).Start();
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -800,7 +792,6 @@ namespace Ink_Canvas
{ {
try try
{ {
// 处理浮动栏状态:根据"退出PPT放映后自动恢复浮动栏状态"设置决定是否恢复
if (Settings.Automation.IsAutoFoldAfterPPTSlideShow) if (Settings.Automation.IsAutoFoldAfterPPTSlideShow)
{ {
if (wasFloatingBarFoldedWhenEnterSlideShow) if (wasFloatingBarFoldedWhenEnterSlideShow)
@@ -823,7 +814,6 @@ namespace Ink_Canvas
} }
else else
{ {
// 如果两个功能都关闭,确保浮动栏展开
if (isFloatingBarFolded) if (isFloatingBarFolded)
{ {
await UnFoldFloatingBar(new object()); await UnFoldFloatingBar(new object());
@@ -908,8 +898,6 @@ namespace Ink_Canvas
await Task.Delay(100); await Task.Delay(100);
await Application.Current.Dispatcher.InvokeAsync(() => await Application.Current.Dispatcher.InvokeAsync(() =>
{ {
// 强制重新计算浮动栏位置,确保在退出PPT模式后正确复位
// 先调用桌面模式的复位方法,然后调用通用的位置计算方法
PureViewboxFloatingBarMarginAnimationInDesktopMode(); PureViewboxFloatingBarMarginAnimationInDesktopMode();
ViewboxFloatingBarMarginAnimation(100, true); ViewboxFloatingBarMarginAnimation(100, true);
}); });
@@ -1468,7 +1456,7 @@ namespace Ink_Canvas
}); });
} }
private async void PPTNavigationBtn_MouseDown(object sender, MouseButtonEventArgs e) private void PPTNavigationBtn_MouseDown(object sender, MouseButtonEventArgs e)
{ {
lastBorderMouseDownObject = sender; lastBorderMouseDownObject = sender;
if (!Settings.PowerPointSettings.EnablePPTButtonPageClickable) return; if (!Settings.PowerPointSettings.EnablePPTButtonPageClickable) return;
@@ -1490,7 +1478,7 @@ namespace Ink_Canvas
} }
} }
private async void PPTNavigationBtn_MouseLeave(object sender, MouseEventArgs e) private void PPTNavigationBtn_MouseLeave(object sender, MouseEventArgs e)
{ {
lastBorderMouseDownObject = null; lastBorderMouseDownObject = null;
if (sender == PPTLSPageButton) if (sender == PPTLSPageButton)
@@ -1511,7 +1499,7 @@ namespace Ink_Canvas
} }
} }
private async void PPTNavigationBtn_MouseUp(object sender, MouseButtonEventArgs e) private void PPTNavigationBtn_MouseUp(object sender, MouseButtonEventArgs e)
{ {
if (lastBorderMouseDownObject != sender) return; if (lastBorderMouseDownObject != sender) return;
@@ -1560,7 +1548,6 @@ namespace Ink_Canvas
// 控制居中 // 控制居中
if (!isFloatingBarFolded) if (!isFloatingBarFolded)
{ {
await Task.Delay(100);
ViewboxFloatingBarMarginAnimation(60); ViewboxFloatingBarMarginAnimation(60);
} }
} }