Skip to content

Commit

Permalink
[NUI] Make UI struct work properly for animation
Browse files Browse the repository at this point in the history
And add OneUI lib for friend assembly of Tizen.NUI.Extension

Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
  • Loading branch information
rabbitfor committed Feb 21, 2025
1 parent e8cf170 commit eaa22c3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Tizen.NUI.Extension/Tizen.NUI.Extension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
<Folder Include="Interop\" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="Tizen.NUI.OneUI, PublicKey=002400000480000094000000060200000024000052534131000400000100010027a569d80f8543114f08f0ac25b7ebfe9528865cdc4d49129cc393d42b043db596b7a701812252464c0493c54326cbcbd8f2d37eb91217120d199fe0b86e1bdfd955873558a630ee595bcca0ade643f1750b22a91060ea4e84639b40b346991f8271f18d4a6bd2802c41762846e13bf0ec0d82d4857be253ee8cbd7c9561c193" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Tizen.NUI/src/internal/Common/PropertyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static object ObjectColorToVector4(object value)
return new Vector4(colorValue.R, colorValue.G, colorValue.B, colorValue.A);
}

return null;
return value is UIColor ? value : null;
}

private static PropertyValue PropertyValueColorToVector4(PropertyValue value)
Expand Down
54 changes: 53 additions & 1 deletion src/Tizen.NUI/src/public/Common/PropertyValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public bool NotEqualTo(PropertyValue rhs)

/// <summary>
/// Hidden API (Inhouse API).
/// Dispose.
/// Dispose.
/// </summary>
/// <remarks>
/// Following the guide of https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose.
Expand Down Expand Up @@ -451,6 +451,32 @@ static public PropertyValue CreateFromObject(System.Object obj)
{
value = new PropertyValue((PropertyMap)obj);
}
else if (type.Equals(typeof(UIColor)))
{
UIColor color = ((UIColor)obj);
value = new PropertyValue(color.R, color.G, color.B, color.A);
}
else if (type.Equals(typeof(UICorner)))
{
UICorner corner = ((UICorner)obj);
value = new PropertyValue(corner.TopLeft, corner.TopRight, corner.BottomRight, corner.BottomLeft);
}
else if (type.Equals(typeof(UIExtents)))
{
// TODO Do not create Extents instance
using Extents extents = ((UIExtents)obj).ToReferenceType();
value = new PropertyValue(extents);
}
else if (type.Equals(typeof(UIVector2)))
{
UIVector2 vector2 = ((UIVector2)obj);
value = new PropertyValue(vector2.X, vector2.Y);
}
else if (type.Equals(typeof(UIVector3)))
{
UIVector3 vector3 = ((UIVector3)obj);
value = new PropertyValue(vector3.X, vector3.Y, vector3.Z);
}
else
{
throw new global::System.InvalidOperationException("Unimplemented type for Property Value :" + type.Name);
Expand Down Expand Up @@ -564,6 +590,32 @@ static public PropertyValue CreateFromObject(System.Object obj)
{
value = Interop.PropertyValue.NewPropertyValueMap(PropertyMap.getCPtr((PropertyMap)(obj)));
}
else if (type.Equals(typeof(UIColor)))
{
UIColor color = ((UIColor)obj);
value = Interop.PropertyValue.NewPropertyValueVector4Componentwise(color.R, color.G, color.B, color.A);
}
else if (type.Equals(typeof(UICorner)))
{
UICorner corner = ((UICorner)obj);
value = Interop.PropertyValue.NewPropertyValueVector4Componentwise(corner.TopLeft, corner.TopRight, corner.BottomRight, corner.BottomLeft);
}
else if (type.Equals(typeof(UIExtents)))
{
// TODO Do not create Extents instance
using Extents extents = ((UIExtents)obj).ToReferenceType();
value = Interop.PropertyValue.NewPropertyValueExtents(Extents.getCPtr(extents));
}
else if (type.Equals(typeof(UIVector2)))
{
UIVector2 vector2 = ((UIVector2)obj);
value = Interop.PropertyValue.NewPropertyValueVector2Componentwise(vector2.X, vector2.Y);
}
else if (type.Equals(typeof(UIVector3)))
{
UIVector3 vector3 = ((UIVector3)obj);
value = Interop.PropertyValue.NewPropertyValueVector3Componentwise(vector3.X, vector3.Y, vector3.Z);
}
else
{
throw new global::System.InvalidOperationException("Unimplemented type for Property Value :" + type.Name);
Expand Down

0 comments on commit eaa22c3

Please sign in to comment.