feat: 选区截图时保留屏幕笔迹 (#406)
* feat: 使用选区截图时,不清除 Strokes(Keep it on screen) * fix: 浮动栏选区截图前强制保持墨迹可见 * fix: 避免选区截图回滚 inkCanvas 运行时状态 * fix: 截图前退出并在结束后恢复批注状态 * fix: 截图流程改用轻量批注暂停避免副作用 * feat: 选区截图添加包含墨迹开关 * fix: 避免选区截图墨迹重复渲染 * fix: 全屏基础截图排除主窗口后再叠加墨迹 * fix: 隐藏浮动栏后再进入选区截图 * fix: 添加到白板时不强制恢复浮动栏可见性 * fix: 防止重复启动选区截图实例 * fix: 仅在白板接管成功后跳过浮动栏恢复 * feat: 选区截图时实时预览包含墨迹开关 * fix: 合并截图选择器OnClosed逻辑避免重复定义
This commit is contained in:
@@ -139,6 +139,17 @@
|
||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
|
||||
Margin="8,0"
|
||||
Background="#404040" />
|
||||
|
||||
<!-- 选项开关 -->
|
||||
<CheckBox Name="IncludeInkCheckBox"
|
||||
Content="包含墨迹"
|
||||
IsChecked="True"
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
FontWeight="Medium"
|
||||
Checked="IncludeInkCheckBox_Checked"
|
||||
Unchecked="IncludeInkCheckBox_Unchecked" />
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<Button Name="ConfirmButton"
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace Ink_Canvas
|
||||
private Bitmap _capturedCameraImage = null;
|
||||
private DateTime _lastBlankClickTime = DateTime.MinValue;
|
||||
private WpfPoint _lastBlankClickPosition;
|
||||
private readonly Action<bool> _includeInkPreviewChanged;
|
||||
|
||||
private const int DoubleClickTimeThresholdMs = 300; // 双击判定时间阈值(常见范围 200~500ms)
|
||||
private const double DoubleClickDistanceThresholdPx = 12; // 双击判定位置阈值(像素)
|
||||
@@ -55,10 +56,17 @@ namespace Ink_Canvas
|
||||
public Bitmap CameraImage { get; private set; }
|
||||
public System.Windows.Media.Imaging.BitmapSource CameraBitmapSource { get; private set; }
|
||||
public bool ShouldAddToWhiteboard { get; private set; }
|
||||
public bool ShouldIncludeInk { get; private set; } = true;
|
||||
|
||||
public ScreenshotSelectorWindow()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public ScreenshotSelectorWindow(Action<bool> includeInkPreviewChanged)
|
||||
{
|
||||
InitializeComponent();
|
||||
_includeInkPreviewChanged = includeInkPreviewChanged;
|
||||
|
||||
// 设置窗口覆盖所有屏幕
|
||||
SetupFullScreenOverlay();
|
||||
@@ -84,6 +92,8 @@ namespace Ink_Canvas
|
||||
timer.Stop();
|
||||
};
|
||||
timer.Start();
|
||||
|
||||
ApplyIncludeInkPreviewState(ShouldIncludeInk);
|
||||
}
|
||||
|
||||
private void InitializeFreehandMode()
|
||||
@@ -529,6 +539,30 @@ namespace Ink_Canvas
|
||||
ConfirmSelection();
|
||||
}
|
||||
|
||||
private void IncludeInkCheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShouldIncludeInk = true;
|
||||
ApplyIncludeInkPreviewState(ShouldIncludeInk);
|
||||
}
|
||||
|
||||
private void IncludeInkCheckBox_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShouldIncludeInk = false;
|
||||
ApplyIncludeInkPreviewState(ShouldIncludeInk);
|
||||
}
|
||||
|
||||
private void ApplyIncludeInkPreviewState(bool shouldIncludeInk)
|
||||
{
|
||||
try
|
||||
{
|
||||
_includeInkPreviewChanged?.Invoke(shouldIncludeInk);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLogToFile($"更新“包含墨迹”实时预览失败: {ex.Message}", LogHelper.LogType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfirmCameraCapture()
|
||||
{
|
||||
try
|
||||
@@ -1480,6 +1514,9 @@ namespace Ink_Canvas
|
||||
{
|
||||
try
|
||||
{
|
||||
// 关闭窗口时恢复墨迹预览状态
|
||||
ApplyIncludeInkPreviewState(true);
|
||||
|
||||
// 清理摄像头资源
|
||||
if (_cameraService != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user