improve:PPT放映时的浮动栏定位

This commit is contained in:
CJK_mkp
2025-12-27 16:41:30 +08:00
parent 73d1dc8f48
commit 3f8cabc7e0
2 changed files with 9 additions and 43 deletions
@@ -3081,11 +3081,8 @@ namespace Ink_Canvas
{ {
await Task.Delay(700); await Task.Delay(700);
await Dispatcher.InvokeAsync(() => await Dispatcher.InvokeAsync(() =>
{
if (_pptManager?.IsInSlideShow != true)
{ {
FoldFloatingBar_MouseUp(new object(), null); FoldFloatingBar_MouseUp(new object(), null);
}
}); });
}); });
} }
+6 -37
View File
@@ -730,7 +730,7 @@ namespace Ink_Canvas
if (Settings.PowerPointSettings.IsShowCanvasAtNewSlideShow && if (Settings.PowerPointSettings.IsShowCanvasAtNewSlideShow &&
!Settings.Automation.IsAutoFoldInPPTSlideShow) !Settings.Automation.IsAutoFoldInPPTSlideShow)
{ {
await Task.Delay(300); await Task.Delay(600);
// 先进入批注模式,这会显示调色盘 // 先进入批注模式,这会显示调色盘
PenIcon_Click(null, null); PenIcon_Click(null, null);
// 然后设置颜色 // 然后设置颜色
@@ -771,48 +771,17 @@ namespace Ink_Canvas
LoadCurrentSlideInk(currentSlide); LoadCurrentSlideInk(currentSlide);
}); });
if (!isFloatingBarFolded) if (!isFloatingBarFolded)
{ {
_ = Task.Run(async () => new Thread(() =>
{ {
try Thread.Sleep(100);
{ Application.Current.Dispatcher.Invoke(() =>
await Task.Delay(100);
await Application.Current.Dispatcher.InvokeAsync(() =>
{
ViewboxFloatingBar.UpdateLayout();
// 如果浮动栏宽度仍未计算好,再等待一段时间
if (ViewboxFloatingBar.ActualWidth <= 0)
{
LogHelper.WriteLogToFile("浮动栏宽度未准备好,等待布局完成", LogHelper.LogType.Trace);
}
});
await Task.Delay(100);
await Application.Current.Dispatcher.InvokeAsync(() =>
{
PureViewboxFloatingBarMarginAnimationInPPTMode(false);
});
}
catch (Exception)
{
try
{
await Task.Delay(100);
await Application.Current.Dispatcher.InvokeAsync(() =>
{ {
ViewboxFloatingBarMarginAnimation(60); ViewboxFloatingBarMarginAnimation(60);
}); });
} }).Start();
catch (Exception)
{
}
}
});
} }
} }
catch (Exception) catch (Exception)