动画bug修复

This commit is contained in:
艾竹
2023-04-08 17:28:38 +08:00
parent 5e7dd6c5e5
commit 2edb4ffb14
2 changed files with 17 additions and 9 deletions

View File

@@ -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);

View File

@@ -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);
}
}