diff --git a/src/Tizen.NUI.Extension/Markup/ViewExtensions.cs b/src/Tizen.NUI.Extension/Markup/ViewExtensions.cs index 1f802fe9824..42d333663b2 100644 --- a/src/Tizen.NUI.Extension/Markup/ViewExtensions.cs +++ b/src/Tizen.NUI.Extension/Markup/ViewExtensions.cs @@ -164,6 +164,18 @@ public static T Size(this T view, float width, float height) where T : View return view; } + /// + /// Sets the size of the view. + /// + /// The type of the view. + /// The extension target. + /// The size value. + /// The view itself. + public static T Size(this T view, UIVector2 size) where T : View + { + return Size(view, size.Width, size.Height); + } + /// /// Sets the size width of the view. /// @@ -205,6 +217,18 @@ public static T Position(this T view, float x, float y) where T : View return view; } + /// + /// Sets the position of the view. + /// + /// The type of the view. + /// The extension target. + /// The position value. + /// The view itself. + public static T Position(this T view, UIVector2 position) where T : View + { + return Position(view, position.X, position.Y); + } + /// /// Sets the position x of the view. /// @@ -637,6 +661,26 @@ public static UIColor BackgroundColor(this View view) return Object.InternalRetrievingVisualPropertyColor(view.SwigCPtr, View.Property.BACKGROUND, ColorVisualProperty.MixColor); } + /// + /// Experimental getter for size + /// + /// The extension target. + /// The size value. + public static UIVector2 Size(this View view) + { + return new UIVector2(view.SizeWidth, view.SizeHeight); + } + + /// + /// Experimental getter for position + /// + /// The extension target. + /// The position value. + public static UIVector2 Position(this View view) + { + return new UIVector2(view.PositionX, view.PositionY); + } + /// /// Gets the corner radius of the view. /// diff --git a/src/Tizen.NUI/src/devel/Lite/UIVector2.cs b/src/Tizen.NUI/src/devel/Lite/UIVector2.cs index f62d73c891b..e2e76ef6af8 100644 --- a/src/Tizen.NUI/src/devel/Lite/UIVector2.cs +++ b/src/Tizen.NUI/src/devel/Lite/UIVector2.cs @@ -68,6 +68,16 @@ public float Y /// public float Height => Y; + /// + /// Converts the UIVector2 to Vector3 class implicitly. + /// + /// A UIVector2 to be converted to Vector3 + public static implicit operator Vector3(UIVector2 uiVector2) + { + return new Vector3(uiVector2.X, uiVector2.Y, 0f); + } + + internal readonly NUI.Vector2 ToReferenceType() => new NUI.Vector2(X, Y); } }