|
|
@ -14,16 +14,20 @@ namespace Avalonia.Media |
|
|
|
|
|
|
|
|
private IDisposable? _childrenNotificationSubscription; |
|
|
private IDisposable? _childrenNotificationSubscription; |
|
|
private readonly EventHandler _childTransformChangedHandler; |
|
|
private readonly EventHandler _childTransformChangedHandler; |
|
|
|
|
|
private Matrix? _lastMatrix; |
|
|
|
|
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012", |
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012", |
|
|
Justification = "Collection properties shouldn't be set with SetCurrentValue.")] |
|
|
Justification = "Collection properties shouldn't be set with SetCurrentValue.")] |
|
|
public TransformGroup() |
|
|
public TransformGroup() |
|
|
{ |
|
|
{ |
|
|
_childTransformChangedHandler = (_, _) => RaiseChanged(); |
|
|
_childTransformChangedHandler = (_, _) => |
|
|
|
|
|
{ |
|
|
|
|
|
_lastMatrix = null; |
|
|
|
|
|
RaiseChanged(); |
|
|
|
|
|
}; |
|
|
Children = new Transforms(); |
|
|
Children = new Transforms(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Gets or sets the children.
|
|
|
/// Gets or sets the children.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -44,14 +48,16 @@ namespace Avalonia.Media |
|
|
{ |
|
|
{ |
|
|
get |
|
|
get |
|
|
{ |
|
|
{ |
|
|
Matrix result = Matrix.Identity; |
|
|
if (_lastMatrix is null) |
|
|
|
|
|
|
|
|
foreach (var t in Children) |
|
|
|
|
|
{ |
|
|
{ |
|
|
result *= t.Value; |
|
|
var matrix = Matrix.Identity; |
|
|
|
|
|
foreach (var t in Children) |
|
|
|
|
|
{ |
|
|
|
|
|
matrix *= t.Value; |
|
|
|
|
|
} |
|
|
|
|
|
_lastMatrix = matrix; |
|
|
} |
|
|
} |
|
|
|
|
|
return _lastMatrix.Value; |
|
|
return result; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|