From bbb30b7c25c7b5731dc0371e10e1664039dc27e4 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 20 Dec 2025 17:30:18 +0800 Subject: [PATCH] =?UTF-8?q?improve:=E5=87=A0=E4=BD=95=E9=95=BF=E6=8C=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs | 35 +++++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs b/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs index d4b69701..1e26a1e4 100644 --- a/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs +++ b/Ink Canvas/MainWindow_cs/MW_ShapeDrawing.cs @@ -154,8 +154,11 @@ namespace Ink_Canvas if (isLongPressSelected) { if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) CollapseBorderDrawShape(); - var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); - ImageDrawLine.BeginAnimation(OpacityProperty, dA); + if (sender is UIElement ui) + { + var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); + ui.BeginAnimation(OpacityProperty, dA); + } } DrawShapePromptToPen(); @@ -177,8 +180,11 @@ namespace Ink_Canvas if (isLongPressSelected) { if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) CollapseBorderDrawShape(); - var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); - ImageDrawDashedLine.BeginAnimation(OpacityProperty, dA); + if (sender is UIElement ui) + { + var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); + ui.BeginAnimation(OpacityProperty, dA); + } } DrawShapePromptToPen(); @@ -200,8 +206,11 @@ namespace Ink_Canvas if (isLongPressSelected) { if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) CollapseBorderDrawShape(); - var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); - ImageDrawDotLine.BeginAnimation(OpacityProperty, dA); + if (sender is UIElement ui) + { + var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); + ui.BeginAnimation(OpacityProperty, dA); + } } DrawShapePromptToPen(); @@ -223,8 +232,11 @@ namespace Ink_Canvas if (isLongPressSelected) { if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) CollapseBorderDrawShape(); - var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); - ImageDrawArrow.BeginAnimation(OpacityProperty, dA); + if (sender is UIElement ui) + { + var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); + ui.BeginAnimation(OpacityProperty, dA); + } } DrawShapePromptToPen(); @@ -246,8 +258,11 @@ namespace Ink_Canvas if (isLongPressSelected) { if (ToggleSwitchDrawShapeBorderAutoHide.IsOn) CollapseBorderDrawShape(); - var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); - ImageDrawParallelLine.BeginAnimation(OpacityProperty, dA); + if (sender is UIElement ui) + { + var dA = new DoubleAnimation(1, 1, new Duration(TimeSpan.FromMilliseconds(0))); + ui.BeginAnimation(OpacityProperty, dA); + } } DrawShapePromptToPen();