From 2edb4ffb147e79dc047d6264533db52fea80acfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=89=BE=E7=AB=B9?= Date: Sat, 8 Apr 2023 17:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BBbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/DesignerCanvas.cs | 4 ++-- .../UserControls/LineControl.xaml.cs | 22 +++++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs b/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs index e81edad..2b281ae 100644 --- a/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs +++ b/AIStudio.Wpf.DiagramDesigner/Controls/DesignerCanvas.cs @@ -354,8 +354,8 @@ namespace AIStudio.Wpf.DiagramDesigner protected override void OnMouseMove(MouseEventArgs e) { - var focusedElement = Keyboard.FocusedElement; - Debug.WriteLine("focusedElement:" + focusedElement?.ToString()); + //var focusedElement = Keyboard.FocusedElement; + //Debug.WriteLine("focusedElement:" + focusedElement?.ToString()); base.OnMouseMove(e); diff --git a/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs b/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs index 4e9b590..1b194b1 100644 --- a/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs +++ b/AIStudio.Wpf.DiagramDesigner/UserControls/LineControl.xaml.cs @@ -42,7 +42,7 @@ namespace AIStudio.Wpf.DiagramDesigner if (this.DataContext is ConnectionViewModel connector && connector.ColorViewModel != null) { connector.ColorViewModel.PropertyChanged -= Connector_PropertyChanged; - connector.PropertyChanged += Connector_PropertyChanged; + connector.ColorViewModel.PropertyChanged += Connector_PropertyChanged; } this.ball.Visibility = Visibility.Collapsed; await DoAnimation(); @@ -68,13 +68,21 @@ namespace AIStudio.Wpf.DiagramDesigner switch (connector.ColorViewModel.LineAnimation) { case LineAnimation.None: - _story?.Stop(); + _story?.Stop(this); ball.Visibility = Visibility.Collapsed; break; - case LineAnimation.PathAnimation: + case LineAnimation.PathAnimation: + if (connector.ColorViewModel.FillColor.BrushType == BrushType.SolidColorBrush && connector.ColorViewModel.FillColor.Color == Colors.White) + { + connector.ColorViewModel.FillColor.Color = Colors.Red; + } PathAnimation(connector.ColorViewModel.LineAnimationDuration); break; case LineAnimation.DashAnimation: + if (connector.ColorViewModel.LineDashStyle == LineDashStyle.None) + { + connector.ColorViewModel.LineDashStyle = LineDashStyle.Dash1; + } DashAnimation(connector.ColorViewModel.LineAnimationDuration); break; } @@ -118,7 +126,7 @@ namespace AIStudio.Wpf.DiagramDesigner animationAngle.Source = PathAnimationSource.Angle; animationAngle.Duration = animationX.Duration; - _story?.Stop(); + _story?.Stop(this); _story = new Storyboard(); _story.RepeatBehavior = RepeatBehavior.Forever; //story.AutoReverse = true; @@ -132,7 +140,7 @@ namespace AIStudio.Wpf.DiagramDesigner Storyboard.SetTargetProperty(animationY, new PropertyPath(TranslateTransform.YProperty)); Storyboard.SetTargetProperty(animationAngle, new PropertyPath(RotateTransform.AngleProperty)); - _story.Begin(this); + _story.Begin(this, true); } @@ -148,11 +156,11 @@ namespace AIStudio.Wpf.DiagramDesigner Storyboard.SetTargetProperty(animation, new PropertyPath("StrokeDashOffset")); Storyboard.SetTarget(animation, this.line); - _story?.Stop(); + _story?.Stop(this); _story = new Storyboard(); _story.RepeatBehavior = RepeatBehavior.Forever; _story.Children.Add(animation); - _story.Begin(this); + _story.Begin(this, true); } }