Animation Completed handling

This commit is contained in:
ClemensFischer 2024-06-17 08:48:32 +02:00
parent af398c72a8
commit 1e4c431a88
2 changed files with 15 additions and 18 deletions

View file

@ -149,13 +149,12 @@ namespace MapControl
{ {
if (centerAnimation != null) if (centerAnimation != null)
{ {
SetValueInternal(CenterProperty, TargetCenter);
UpdateTransform();
centerAnimation.Completed -= CenterAnimationCompleted; centerAnimation.Completed -= CenterAnimationCompleted;
centerAnimation = null; centerAnimation = null;
BeginAnimation(CenterProperty, null); BeginAnimation(CenterProperty, null);
SetValueInternal(CenterProperty, TargetCenter);
UpdateTransform();
} }
} }
@ -215,13 +214,12 @@ namespace MapControl
{ {
if (zoomLevelAnimation != null) if (zoomLevelAnimation != null)
{ {
SetValueInternal(ZoomLevelProperty, TargetZoomLevel);
UpdateTransform(true);
zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted; zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted;
zoomLevelAnimation = null; zoomLevelAnimation = null;
BeginAnimation(ZoomLevelProperty, null); BeginAnimation(ZoomLevelProperty, null);
SetValueInternal(ZoomLevelProperty, TargetZoomLevel);
UpdateTransform(true);
} }
} }
@ -276,13 +274,12 @@ namespace MapControl
{ {
if (headingAnimation != null) if (headingAnimation != null)
{ {
SetValueInternal(HeadingProperty, TargetHeading);
UpdateTransform();
headingAnimation.Completed -= HeadingAnimationCompleted; headingAnimation.Completed -= HeadingAnimationCompleted;
headingAnimation = null; headingAnimation = null;
BeginAnimation(HeadingProperty, null); BeginAnimation(HeadingProperty, null);
SetValueInternal(HeadingProperty, TargetHeading);
UpdateTransform();
} }
} }
} }

View file

@ -175,11 +175,11 @@ namespace MapControl
{ {
if (centerAnimation != null) if (centerAnimation != null)
{ {
SetValueInternal(CenterProperty, TargetCenter);
UpdateTransform();
centerAnimation.Completed -= CenterAnimationCompleted; centerAnimation.Completed -= CenterAnimationCompleted;
centerAnimation = null; centerAnimation = null;
SetValueInternal(CenterProperty, TargetCenter);
UpdateTransform();
} }
} }
@ -270,11 +270,11 @@ namespace MapControl
{ {
if (zoomLevelAnimation != null) if (zoomLevelAnimation != null)
{ {
SetValueInternal(ZoomLevelProperty, TargetZoomLevel);
UpdateTransform(true);
zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted; zoomLevelAnimation.Completed -= ZoomLevelAnimationCompleted;
zoomLevelAnimation = null; zoomLevelAnimation = null;
SetValueInternal(ZoomLevelProperty, TargetZoomLevel);
UpdateTransform(true);
} }
} }
@ -346,11 +346,11 @@ namespace MapControl
{ {
if (headingAnimation != null) if (headingAnimation != null)
{ {
SetValueInternal(HeadingProperty, TargetHeading);
UpdateTransform();
headingAnimation.Completed -= HeadingAnimationCompleted; headingAnimation.Completed -= HeadingAnimationCompleted;
headingAnimation = null; headingAnimation = null;
SetValueInternal(HeadingProperty, TargetHeading);
UpdateTransform();
} }
} }