Skip to content

Commit 1f6630e

Browse files
committed
Merge branch 'main' into winui
# Conflicts: # CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/ScalarNode.cs # CommunityToolkit.WinUI.UI.Animations/Extensions/System/FloatExtensions.cs
2 parents 4c8f61e + 6fd3327 commit 1f6630e

File tree

18 files changed

+168
-32
lines changed

18 files changed

+168
-32
lines changed

CommunityToolkit.Mvvm/ComponentModel/Attributes/AlsoNotifyChangeForAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ namespace CommunityToolkit.Mvvm.ComponentModel
6767
/// }
6868
/// </code>
6969
/// </summary>
70-
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
70+
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
7171
public sealed class AlsoNotifyChangeForAttribute : Attribute
7272
{
7373
/// <summary>
@@ -87,7 +87,7 @@ public AlsoNotifyChangeForAttribute(string propertyName)
8787
/// The other property names to also notify when the annotated property changes. This parameter can optionally
8888
/// be used to indicate a series of dependent properties from the same attribute, to keep the code more compact.
8989
/// </param>
90-
public AlsoNotifyChangeForAttribute(string propertyName, string[] otherPropertyNames)
90+
public AlsoNotifyChangeForAttribute(string propertyName, params string[] otherPropertyNames)
9191
{
9292
PropertyNames = new[] { propertyName }.Concat(otherPropertyNames).ToArray();
9393
}

CommunityToolkit.WinUI.UI.Animations/Expressions/CompositionExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ public static void StartAnimation(this CompositionObject compObject, string prop
176176
/// <param name="easing">The easing function to use when interpolating between frames.</param>
177177
public static void InsertExpressionKeyFrame(this KeyFrameAnimation keyframeAnimation, float normalizedProgressKey, ExpressionNode expressionNode, CompositionEasingFunction easing = null)
178178
{
179+
expressionNode.ClearReferenceInfo();
180+
179181
keyframeAnimation.InsertExpressionKeyFrame(normalizedProgressKey, expressionNode.ToExpressionString(), easing);
180182

181183
expressionNode.SetAllParameters(keyframeAnimation);
@@ -252,6 +254,7 @@ private static ExpressionAnimation CreateExpressionAnimationFromNode(Compositor
252254
// Only create a new animation if this node hasn't already generated one before, so we don't have to re-parse the expression string.
253255
if (expressionNode.ExpressionAnimation == null)
254256
{
257+
expressionNode.ClearReferenceInfo();
255258
expressionNode.ExpressionAnimation = compositor.CreateExpressionAnimation(expressionNode.ToExpressionString());
256259
}
257260

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/ExpressionNode.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,20 @@ internal string ToExpressionString()
260260
return ToExpressionStringInternal();
261261
}
262262

263+
/// <summary>
264+
/// Clears the reference information.
265+
/// </summary>
266+
/// <exception cref="System.Exception">Reference and paramName can't both be null</exception>
267+
internal void ClearReferenceInfo()
268+
{
269+
_objRefList = null;
270+
ParamName = null;
271+
foreach (var child in Children)
272+
{
273+
child.ClearReferenceInfo();
274+
}
275+
}
276+
263277
/// <summary>
264278
/// Ensures the reference information.
265279
/// </summary>

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/Matrix3x2Node.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3,
332332
/// <returns>System.String.</returns>
333333
protected internal override string GetValue()
334334
{
335-
return $"Matrix3x2({_value.M11},{_value.M12},{_value.M21},{_value.M22},{_value.M31},{_value.M32})";
335+
return $"Matrix3x2({_value.M11.ToCompositionString()},{_value.M12.ToCompositionString()},{_value.M21.ToCompositionString()},{_value.M22.ToCompositionString()},{_value.M31.ToCompositionString()},{_value.M32.ToCompositionString()})";
336336
}
337337

338338
private Matrix3x2 _value;

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/Matrix4x4Node.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3,
403403
/// <returns>System.String.</returns>
404404
protected internal override string GetValue()
405405
{
406-
return $"Matrix4x4({_value.M11},{_value.M12},{_value.M13},{_value.M14}," +
407-
$"{_value.M21},{_value.M22},{_value.M23},{_value.M24}," +
408-
$"{_value.M31},{_value.M32},{_value.M33},{_value.M34}," +
409-
$"{_value.M41},{_value.M42},{_value.M43},{_value.M44})";
406+
return $"Matrix4x4({_value.M11.ToCompositionString()},{_value.M12.ToCompositionString()},{_value.M13.ToCompositionString()},{_value.M14.ToCompositionString()}," +
407+
$"{_value.M21.ToCompositionString()},{_value.M22.ToCompositionString()},{_value.M23.ToCompositionString()},{_value.M24.ToCompositionString()}," +
408+
$"{_value.M31.ToCompositionString()},{_value.M32.ToCompositionString()},{_value.M33.ToCompositionString()},{_value.M34.ToCompositionString()}," +
409+
$"{_value.M41.ToCompositionString()},{_value.M42.ToCompositionString()},{_value.M43.ToCompositionString()},{_value.M44.ToCompositionString()})";
410410
}
411411

412412
private Matrix4x4 _value;

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/QuaternionNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static implicit operator QuaternionNode(Quaternion value)
126126
/// <returns>System.String.</returns>
127127
protected internal override string GetValue()
128128
{
129-
return $"Quaternion({_value.X},{_value.Y},{_value.Z},{_value.W})";
129+
return $"Quaternion({_value.X.ToCompositionString()},{_value.Y.ToCompositionString()},{_value.Z.ToCompositionString()},{_value.W.ToCompositionString()})";
130130
}
131131

132132
private Quaternion _value;

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/ScalarNode.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ public static implicit operator ScalarNode(int value)
254254
/// <returns>System.String.</returns>
255255
protected internal override string GetValue()
256256
{
257-
// Important to use invariant culture to make sure that floats are written using a .
258-
return _value.ToString(global::System.Globalization.CultureInfo.InvariantCulture);
257+
return _value.ToCompositionString();
259258
}
260259

261260
private float _value;

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/Vector2Node.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3,
297297
/// <returns>System.String.</returns>
298298
protected internal override string GetValue()
299299
{
300-
return $"Vector2({_value.X},{_value.Y})";
300+
return $"Vector2({_value.X.ToCompositionString()},{_value.Y.ToCompositionString()})";
301301
}
302302

303303
private Vector2 _value;

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/Vector3Node.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3,
320320
/// <returns>System.String.</returns>
321321
protected internal override string GetValue()
322322
{
323-
return $"Vector3({_value.X},{_value.Y},{_value.Z})";
323+
return $"Vector3({_value.X.ToCompositionString()},{_value.Y.ToCompositionString()},{_value.Z.ToCompositionString()})";
324324
}
325325

326326
private Vector3 _value;

CommunityToolkit.WinUI.UI.Animations/Expressions/ExpressionNodes/Vector4Node.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public Matrix4x4Node GetSubchannels(Subchannel s1, Subchannel s2, Subchannel s3,
343343
/// <returns>System.String.</returns>
344344
protected internal override string GetValue()
345345
{
346-
return $"Vector4({_value.X},{_value.Y},{_value.Z},{_value.W})";
346+
return $"Vector4({_value.X.ToCompositionString()},{_value.Y.ToCompositionString()},{_value.Z.ToCompositionString()},{_value.W.ToCompositionString()})";
347347
}
348348

349349
private Vector4 _value;

0 commit comments

Comments
 (0)