Browse Source

Add isManuallyStarted to IAnimation interface

pull/20966/head
Jumar Macato 17 hours ago
parent
commit
969f7858fc
  1. 5
      src/Avalonia.Base/Animation/Animation.cs
  2. 3
      src/Avalonia.Base/Animation/IAnimation.cs
  3. 3
      src/Avalonia.Base/Styling/StyleInstance.cs

5
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<bool> match, Action? onComplete)
=> Apply(control, clock, match, onComplete, isManuallyStarted: false);
IDisposable IAnimation.Apply(Animatable control, IClock? clock, IObservable<bool> match, Action? onComplete,
bool isManuallyStarted)
=> Apply(control, clock, match, onComplete, isManuallyStarted);
/// <inheritdoc cref="IAnimation.Apply"/>
internal IDisposable Apply(Animatable control, IClock? clock, IObservable<bool> match, Action? onComplete,

3
src/Avalonia.Base/Animation/IAnimation.cs

@ -14,7 +14,8 @@ namespace Avalonia.Animation
/// <summary>
/// Apply the animation to the specified control and run it when <paramref name="match" /> produces <c>true</c>.
/// </summary>
internal IDisposable Apply(Animatable control, IClock? clock, IObservable<bool> match, Action? onComplete = null);
internal IDisposable Apply(Animatable control, IClock? clock, IObservable<bool> match,
Action? onComplete = null, bool isManuallyStarted = false);
/// <summary>
/// Run the animation on the specified control.

3
src/Avalonia.Base/Styling/StyleInstance.cs

@ -72,7 +72,8 @@ namespace Avalonia.Styling
_animationTrigger ??= new LightweightSubject<bool>();
_animationApplyDisposables ??= new List<IDisposable>();
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);

Loading…
Cancel
Save