|
|
@ -49,10 +49,10 @@ namespace Avalonia.Animation |
|
|
} |
|
|
} |
|
|
set |
|
|
set |
|
|
{ |
|
|
{ |
|
|
if (_transitions == null) |
|
|
if (value is null) |
|
|
_transitions = new Transitions(); |
|
|
return; |
|
|
|
|
|
|
|
|
if (_previousTransitions == null) |
|
|
if (_previousTransitions is null) |
|
|
_previousTransitions = new Dictionary<AvaloniaProperty, IDisposable>(); |
|
|
_previousTransitions = new Dictionary<AvaloniaProperty, IDisposable>(); |
|
|
|
|
|
|
|
|
SetAndRaise(TransitionsProperty, ref _transitions, value); |
|
|
SetAndRaise(TransitionsProperty, ref _transitions, value); |
|
|
@ -66,19 +66,18 @@ namespace Avalonia.Animation |
|
|
/// <param name="e">The event args.</param>
|
|
|
/// <param name="e">The event args.</param>
|
|
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e) |
|
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e) |
|
|
{ |
|
|
{ |
|
|
if (e.Priority != BindingPriority.Animation && Transitions != null && _previousTransitions != null) |
|
|
if (Transitions is null || e.Priority == BindingPriority.Animation) return; |
|
|
{ |
|
|
|
|
|
var match = Transitions.FirstOrDefault(x => x.Property == e.Property); |
|
|
var match = Transitions.FirstOrDefault(x => x.Property == e.Property); |
|
|
|
|
|
|
|
|
if (match != null) |
|
|
if (match != null) |
|
|
{ |
|
|
{ |
|
|
if (_previousTransitions.TryGetValue(e.Property, out var dispose)) |
|
|
if (_previousTransitions.TryGetValue(e.Property, out var dispose)) |
|
|
dispose.Dispose(); |
|
|
dispose.Dispose(); |
|
|
|
|
|
|
|
|
var instance = match.Apply(this, Clock ?? Avalonia.Animation.Clock.GlobalClock, e.OldValue, e.NewValue); |
|
|
var instance = match.Apply(this, Clock ?? Avalonia.Animation.Clock.GlobalClock, e.OldValue, e.NewValue); |
|
|
|
|
|
|
|
|
_previousTransitions[e.Property] = instance; |
|
|
_previousTransitions[e.Property] = instance; |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|