feat: 启用避免全屏助手时自动全屏处理白板和批注模式

- 进入白板/批注模式时自动全屏
- 退出时恢复工作区域大小
- 添加状态跟踪避免重复处理
- PPT放映模式和白板模式切换时正确管理全屏状态
This commit is contained in:
PrefacedCorg
2025-12-20 13:03:31 +08:00
parent 6222fabdd4
commit d5cac938c2
3 changed files with 48 additions and 0 deletions
+4
View File
@@ -107,6 +107,8 @@ namespace Ink_Canvas.Helpers
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}), DispatcherPriority.ApplicationIdle);
_mainWindow.isFullScreenApplied = true; // 标记已应用全屏处理
}
}
else
@@ -127,6 +129,8 @@ namespace Ink_Canvas.Helpers
workingArea.X, workingArea.Y,
workingArea.Width, workingArea.Height, true);
}), DispatcherPriority.ApplicationIdle);
_mainWindow.isFullScreenApplied = false; // 标记全屏处理已还原
}
}
}
+3
View File
@@ -67,6 +67,9 @@ namespace Ink_Canvas
// 设置面板相关状态
private bool userChangedNoFocusModeInSettings;
private bool isTemporarilyDisablingNoFocusMode = false;
// 全屏处理状态标志
public bool isFullScreenApplied = false;
@@ -3075,6 +3075,8 @@ namespace Ink_Canvas
workingArea.Left, workingArea.Top,
workingArea.Width, workingArea.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = false; // 标记全屏处理已还原
}
// 在屏幕模式下恢复基础浮动栏的显示
@@ -3144,6 +3146,8 @@ namespace Ink_Canvas
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = true; // 标记已应用全屏处理
}
ViewboxFloatingBar.Visibility = Visibility.Collapsed;
@@ -3201,6 +3205,7 @@ namespace Ink_Canvas
{
if (GridTransparencyFakeBackground.Background == Brushes.Transparent)
{
// 进入批注模式
GridTransparencyFakeBackground.Opacity = 1;
GridTransparencyFakeBackground.Background = new SolidColorBrush(StringToColor("#01FFFFFF"));
inkCanvas.IsHitTestVisible = true;
@@ -3225,6 +3230,21 @@ namespace Ink_Canvas
}
BtnHideInkCanvas.Content = "隐藏\n画板";
// 进入批注模式时的全屏处理(仅当未应用过全屏处理时)
if (Settings.Advanced.IsEnableAvoidFullScreenHelper && !isFullScreenApplied)
{
// 设置为画板模式,允许全屏操作
AvoidFullScreenHelper.SetBoardMode(true);
Dispatcher.BeginInvoke(new Action(() =>
{
MainWindow.MoveWindow(new WindowInteropHelper(this).Handle, 0, 0,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = true; // 标记已应用全屏处理
}
}
else
{
@@ -3275,6 +3295,27 @@ namespace Ink_Canvas
GridBackgroundCoverHolder.Visibility = Visibility.Collapsed;
// 退出批注模式时的全屏还原(仅当之前应用过全屏处理且不在白板模式时)
if (Settings.Advanced.IsEnableAvoidFullScreenHelper &&
isFullScreenApplied &&
currentMode == 0 && // 不在白板模式
BtnPPTSlideShowEnd.Visibility != Visibility.Visible) // 不在PPT放映模式
{
// 恢复为非画板模式,重新启用全屏限制
AvoidFullScreenHelper.SetBoardMode(false);
Dispatcher.BeginInvoke(new Action(() =>
{
// 退出批注模式,恢复到工作区域大小
var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
MainWindow.MoveWindow(new WindowInteropHelper(this).Handle,
workingArea.Left, workingArea.Top,
workingArea.Width, workingArea.Height, true);
}), DispatcherPriority.ApplicationIdle);
isFullScreenApplied = false; // 标记全屏处理已还原
}
if (currentMode != 0)
{
SaveStrokes();