From 969f7858fc37d48a662b69af2eea8f14e61d7e2f Mon Sep 17 00:00:00 2001 From: Jumar Macato <16554748+jmacato@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:08:32 +0800 Subject: [PATCH] Add isManuallyStarted to IAnimation interface --- src/Avalonia.Base/Animation/Animation.cs | 5 +++-- src/Avalonia.Base/Animation/IAnimation.cs | 3 ++- src/Avalonia.Base/Styling/StyleInstance.cs | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Base/Animation/Animation.cs b/src/Avalonia.Base/Animation/Animation.cs index 0b3772f7fa..5f15f14534 100644 --- a/src/Avalonia.Base/Animation/Animation.cs +++ b/src/Avalonia.Base/Animation/Animation.cs @@ -295,8 +295,9 @@ namespace Avalonia.Animation return (newAnimatorInstances, subscriptions, animatesVisibility); } - IDisposable IAnimation.Apply(Animatable control, IClock? clock, IObservable match, Action? onComplete) - => Apply(control, clock, match, onComplete, isManuallyStarted: false); + IDisposable IAnimation.Apply(Animatable control, IClock? clock, IObservable match, Action? onComplete, + bool isManuallyStarted) + => Apply(control, clock, match, onComplete, isManuallyStarted); /// internal IDisposable Apply(Animatable control, IClock? clock, IObservable match, Action? onComplete, diff --git a/src/Avalonia.Base/Animation/IAnimation.cs b/src/Avalonia.Base/Animation/IAnimation.cs index a5b8b75b12..53146a3edd 100644 --- a/src/Avalonia.Base/Animation/IAnimation.cs +++ b/src/Avalonia.Base/Animation/IAnimation.cs @@ -14,7 +14,8 @@ namespace Avalonia.Animation /// /// Apply the animation to the specified control and run it when produces true. /// - internal IDisposable Apply(Animatable control, IClock? clock, IObservable match, Action? onComplete = null); + internal IDisposable Apply(Animatable control, IClock? clock, IObservable match, + Action? onComplete = null, bool isManuallyStarted = false); /// /// Run the animation on the specified control. diff --git a/src/Avalonia.Base/Styling/StyleInstance.cs b/src/Avalonia.Base/Styling/StyleInstance.cs index c397aef8c6..1ecaf3734a 100644 --- a/src/Avalonia.Base/Styling/StyleInstance.cs +++ b/src/Avalonia.Base/Styling/StyleInstance.cs @@ -72,7 +72,8 @@ namespace Avalonia.Styling _animationTrigger ??= new LightweightSubject(); _animationApplyDisposables ??= new List(); foreach (var animation in _animations) - _animationApplyDisposables.Add(animation.Apply(animatable, null, _animationTrigger)); + _animationApplyDisposables.Add(animation.Apply(animatable, null, _animationTrigger, + onComplete: null, isManuallyStarted: false)); if (_activator is null) _animationTrigger.OnNext(true);