mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 00:37:19 +08:00
动画bug修复
This commit is contained in:
@@ -354,8 +354,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
protected override void OnMouseMove(MouseEventArgs e)
|
protected override void OnMouseMove(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var focusedElement = Keyboard.FocusedElement;
|
//var focusedElement = Keyboard.FocusedElement;
|
||||||
Debug.WriteLine("focusedElement:" + focusedElement?.ToString());
|
//Debug.WriteLine("focusedElement:" + focusedElement?.ToString());
|
||||||
|
|
||||||
base.OnMouseMove(e);
|
base.OnMouseMove(e);
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
if (this.DataContext is ConnectionViewModel connector && connector.ColorViewModel != null)
|
if (this.DataContext is ConnectionViewModel connector && connector.ColorViewModel != null)
|
||||||
{
|
{
|
||||||
connector.ColorViewModel.PropertyChanged -= Connector_PropertyChanged;
|
connector.ColorViewModel.PropertyChanged -= Connector_PropertyChanged;
|
||||||
connector.PropertyChanged += Connector_PropertyChanged;
|
connector.ColorViewModel.PropertyChanged += Connector_PropertyChanged;
|
||||||
}
|
}
|
||||||
this.ball.Visibility = Visibility.Collapsed;
|
this.ball.Visibility = Visibility.Collapsed;
|
||||||
await DoAnimation();
|
await DoAnimation();
|
||||||
@@ -68,13 +68,21 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
switch (connector.ColorViewModel.LineAnimation)
|
switch (connector.ColorViewModel.LineAnimation)
|
||||||
{
|
{
|
||||||
case LineAnimation.None:
|
case LineAnimation.None:
|
||||||
_story?.Stop();
|
_story?.Stop(this);
|
||||||
ball.Visibility = Visibility.Collapsed;
|
ball.Visibility = Visibility.Collapsed;
|
||||||
break;
|
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);
|
PathAnimation(connector.ColorViewModel.LineAnimationDuration);
|
||||||
break;
|
break;
|
||||||
case LineAnimation.DashAnimation:
|
case LineAnimation.DashAnimation:
|
||||||
|
if (connector.ColorViewModel.LineDashStyle == LineDashStyle.None)
|
||||||
|
{
|
||||||
|
connector.ColorViewModel.LineDashStyle = LineDashStyle.Dash1;
|
||||||
|
}
|
||||||
DashAnimation(connector.ColorViewModel.LineAnimationDuration);
|
DashAnimation(connector.ColorViewModel.LineAnimationDuration);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -118,7 +126,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
animationAngle.Source = PathAnimationSource.Angle;
|
animationAngle.Source = PathAnimationSource.Angle;
|
||||||
animationAngle.Duration = animationX.Duration;
|
animationAngle.Duration = animationX.Duration;
|
||||||
|
|
||||||
_story?.Stop();
|
_story?.Stop(this);
|
||||||
_story = new Storyboard();
|
_story = new Storyboard();
|
||||||
_story.RepeatBehavior = RepeatBehavior.Forever;
|
_story.RepeatBehavior = RepeatBehavior.Forever;
|
||||||
//story.AutoReverse = true;
|
//story.AutoReverse = true;
|
||||||
@@ -132,7 +140,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
Storyboard.SetTargetProperty(animationY, new PropertyPath(TranslateTransform.YProperty));
|
Storyboard.SetTargetProperty(animationY, new PropertyPath(TranslateTransform.YProperty));
|
||||||
Storyboard.SetTargetProperty(animationAngle, new PropertyPath(RotateTransform.AngleProperty));
|
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.SetTargetProperty(animation, new PropertyPath("StrokeDashOffset"));
|
||||||
Storyboard.SetTarget(animation, this.line);
|
Storyboard.SetTarget(animation, this.line);
|
||||||
|
|
||||||
_story?.Stop();
|
_story?.Stop(this);
|
||||||
_story = new Storyboard();
|
_story = new Storyboard();
|
||||||
_story.RepeatBehavior = RepeatBehavior.Forever;
|
_story.RepeatBehavior = RepeatBehavior.Forever;
|
||||||
_story.Children.Add(animation);
|
_story.Children.Add(animation);
|
||||||
_story.Begin(this);
|
_story.Begin(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user