From fa7f3d44e4306709c4e439fc133af7a2c9b17288 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sun, 31 Aug 2025 09:59:49 +0800 Subject: [PATCH] =?UTF-8?q?improve:=E6=88=AA=E5=9B=BE=E5=8F=8A=E6=B5=AE?= =?UTF-8?q?=E5=8A=A8=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow.xaml.cs | 6 +++++- Ink Canvas/MainWindow_cs/MW_AutoFold.cs | 12 +++++++---- .../MainWindow_cs/MW_FloatingBarIcons.cs | 18 ++++++++++++++++ Ink Canvas/MainWindow_cs/MW_Settings.cs | 21 +++++++++++-------- .../Windows/ScreenshotSelectorWindow.xaml.cs | 15 +++++++------ 5 files changed, 50 insertions(+), 22 deletions(-) diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index 8a2a414d..c3ace02e 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -100,7 +100,11 @@ namespace Ink_Canvas (workingArea.Width - floatingBarWidth) / 2, workingArea.Bottom - 60 - workingArea.Top, -2000, -200); - ViewboxFloatingBarMarginAnimation(100, true); + // 新增:只在屏幕模式下初始化浮动栏动画 + if (currentMode == 0) + { + ViewboxFloatingBarMarginAnimation(100, true); + } try { diff --git a/Ink Canvas/MainWindow_cs/MW_AutoFold.cs b/Ink Canvas/MainWindow_cs/MW_AutoFold.cs index 98f6b9b0..a92b0394 100644 --- a/Ink Canvas/MainWindow_cs/MW_AutoFold.cs +++ b/Ink Canvas/MainWindow_cs/MW_AutoFold.cs @@ -269,10 +269,14 @@ namespace Ink_Canvas if (dopsc[3] == '2' && !isDisplayingOrHidingBlackboard) AnimationsHelper.ShowWithFadeIn(RightSidePanelForPPTNavigation); } - if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) - ViewboxFloatingBarMarginAnimation(60); - else - ViewboxFloatingBarMarginAnimation(100, true); + // 新增:只在屏幕模式下显示浮动栏 + if (currentMode == 0) + { + if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) + ViewboxFloatingBarMarginAnimation(60); + else + ViewboxFloatingBarMarginAnimation(100, true); + } SidePannelMarginAnimation(-50, !unfoldFloatingBarByUser); }); diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index 6d8e3dfe..35b1f2a5 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -1298,6 +1298,12 @@ namespace Ink_Canvas public async void ViewboxFloatingBarMarginAnimation(int MarginFromEdge, bool PosXCaculatedWithTaskbarHeight = false) { + // 新增:在白板模式下不执行浮动栏动画 + if (currentMode == 1) + { + return; + } + if (MarginFromEdge == 60) MarginFromEdge = 55; await Dispatcher.InvokeAsync(() => { @@ -1417,6 +1423,12 @@ namespace Ink_Canvas public async void PureViewboxFloatingBarMarginAnimationInDesktopMode() { + // 新增:在白板模式下不执行浮动栏动画 + if (currentMode == 1) + { + return; + } + await Dispatcher.InvokeAsync(() => { ViewboxFloatingBar.Visibility = Visibility.Visible; @@ -1493,6 +1505,12 @@ namespace Ink_Canvas public async void PureViewboxFloatingBarMarginAnimationInPPTMode() { + // 新增:在白板模式下不执行浮动栏动画 + if (currentMode == 1) + { + return; + } + await Dispatcher.InvokeAsync(() => { ViewboxFloatingBar.Visibility = Visibility.Visible; diff --git a/Ink Canvas/MainWindow_cs/MW_Settings.cs b/Ink Canvas/MainWindow_cs/MW_Settings.cs index 6f100340..803000f5 100644 --- a/Ink Canvas/MainWindow_cs/MW_Settings.cs +++ b/Ink Canvas/MainWindow_cs/MW_Settings.cs @@ -197,11 +197,14 @@ namespace Ink_Canvas val > 0.5 && val < 1.25 ? val : val <= 0.5 ? 0.5 : val >= 1.25 ? 1.25 : 1; ViewboxFloatingBarScaleTransform.ScaleY = val > 0.5 && val < 1.25 ? val : val <= 0.5 ? 0.5 : val >= 1.25 ? 1.25 : 1; - // auto align - if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) - ViewboxFloatingBarMarginAnimation(60); - else - ViewboxFloatingBarMarginAnimation(100, true); + // auto align - 新增:只在屏幕模式下重新计算浮动栏位置 + if (currentMode == 0) + { + if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) + ViewboxFloatingBarMarginAnimation(60); + else + ViewboxFloatingBarMarginAnimation(100, true); + } } private void ViewboxFloatingBarOpacityValueSlider_ValueChanged(object sender, RoutedEventArgs e) @@ -2687,14 +2690,14 @@ namespace Ink_Canvas await Task.Delay(100); // 获取当前选中的模式并重新设置高光位置 - string currentMode = GetCurrentSelectedMode(); - if (!string.IsNullOrEmpty(currentMode)) + string selectedToolMode = GetCurrentSelectedMode(); + if (!string.IsNullOrEmpty(selectedToolMode)) { - SetFloatingBarHighlightPosition(currentMode); + SetFloatingBarHighlightPosition(selectedToolMode); } // 重新计算浮动栏位置,因为按钮可见性变化会影响浮动栏宽度 - if (!isFloatingBarFolded) + if (!isFloatingBarFolded && currentMode == 0) // 新增:只在屏幕模式下重新计算浮动栏位置 { if (BtnPPTSlideShowEnd.Visibility == Visibility.Visible) { diff --git a/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs b/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs index 8f99d122..4884b80a 100644 --- a/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs +++ b/Ink Canvas/Windows/ScreenshotSelectorWindow.xaml.cs @@ -282,15 +282,14 @@ namespace Ink_Canvas if (_isFreehandMode) { // 自由绘制模式:一笔完成,直接截图 - if (_freehandPoints.Count > 3) // 确保有足够的点 + if (_freehandPoints.Count > 1) // 只要有点就可以截图 { // 创建路径的副本,避免修改原始列表 var pathPoints = new List(_freehandPoints); - // 确保路径闭合(如果最后一个点不是起始点,则添加起始点) - if (pathPoints.Count > 0 && - (Math.Abs(pathPoints[pathPoints.Count - 1].X - _startPoint.X) > 15 || - Math.Abs(pathPoints[pathPoints.Count - 1].Y - _startPoint.Y) > 15)) + // 简化路径处理,不强制闭合 + // 如果路径没有闭合,自动添加起始点 + if (pathPoints.Count > 0) { pathPoints.Add(_startPoint); } @@ -305,7 +304,7 @@ namespace Ink_Canvas var bounds = CalculatePathBounds(optimizedPath); // 确保边界矩形有效 - if (bounds.Width > 1 && bounds.Height > 1) + if (bounds.Width >= 0 && bounds.Height >= 0) { var dpiScale = GetDpiScale(); var virtualScreen = SystemInformation.VirtualScreen; @@ -654,8 +653,8 @@ namespace Ink_Canvas // 计算当前点到前后两点连线的距离 var distance = DistanceToLine(current, prev, next); - // 如果距离大于阈值,保留这个点 - if (distance > 2.0) + // 进一步降低阈值,保留更多点,确保路径质量 + if (distance > 0.1) // 从0.5降低到0.1 { optimized.Add(current); }