Shaojun Li
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
10 additions and
1 deletions
-
src/Avalonia.Base/Styling/StyleInstance.cs
|
|
|
@ -25,6 +25,7 @@ namespace Avalonia.Styling |
|
|
|
private bool _isActive; |
|
|
|
private List<ISetterInstance>? _setters; |
|
|
|
private List<IAnimation>? _animations; |
|
|
|
private List<IDisposable>? _animationApplyDisposables; |
|
|
|
private LightweightSubject<bool>? _animationTrigger; |
|
|
|
|
|
|
|
public StyleInstance( |
|
|
|
@ -69,8 +70,9 @@ namespace Avalonia.Styling |
|
|
|
if (_animations is not null && control is Animatable animatable) |
|
|
|
{ |
|
|
|
_animationTrigger ??= new LightweightSubject<bool>(); |
|
|
|
_animationApplyDisposables ??= new List<IDisposable>(); |
|
|
|
foreach (var animation in _animations) |
|
|
|
animation.Apply(animatable, null, _animationTrigger); |
|
|
|
_animationApplyDisposables.Add(animation.Apply(animatable, null, _animationTrigger)); |
|
|
|
|
|
|
|
if (_activator is null) |
|
|
|
_animationTrigger.OnNext(true); |
|
|
|
@ -81,6 +83,13 @@ namespace Avalonia.Styling |
|
|
|
{ |
|
|
|
base.Dispose(); |
|
|
|
_activator?.Dispose(); |
|
|
|
if (_animationApplyDisposables != null) |
|
|
|
{ |
|
|
|
foreach (var item in _animationApplyDisposables) |
|
|
|
{ |
|
|
|
item.Dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public new void MakeShared() => base.MakeShared(); |
|
|
|
|