improve:截图及浮动栏

This commit is contained in:
2025-08-31 09:59:49 +08:00
parent 9bb00489fe
commit fa7f3d44e4
5 changed files with 50 additions and 22 deletions
+5 -1
View File
@@ -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
{
+8 -4
View File
@@ -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);
});
@@ -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;
+12 -9
View File
@@ -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)
{
@@ -282,15 +282,14 @@ namespace Ink_Canvas
if (_isFreehandMode)
{
// 自由绘制模式:一笔完成,直接截图
if (_freehandPoints.Count > 3) // 确保有足够的点
if (_freehandPoints.Count > 1) // 只要有点就可以截图
{
// 创建路径的副本,避免修改原始列表
var pathPoints = new List<Point>(_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);
}