From 4c02de44c4495a04d84becbe54f552dfcff4ac85 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Mon, 27 Nov 2017 23:38:05 +0900 Subject: [PATCH] [NUI] temporary fix! fix wrong value of screen position in object dump - This is temporary fix, just NUI workaround, will be removed later. Change-Id: Ia17fb4cff3f9c2a063108b69dafc6df3448d00c1 Signed-off-by: dongsug.song --- src/Tizen.NUI/src/public/BaseComponents/View.cs | 4 ++++ src/Tizen.NUI/src/public/Layer.cs | 8 +++++++- src/Tizen.NUI/src/public/NUIApplication.cs | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/Tizen.NUI/src/public/BaseComponents/View.cs diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs old mode 100644 new mode 100755 index 16db451..ddaad58 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -2165,6 +2165,10 @@ namespace Tizen.NUI.BaseComponents { Vector2 temp = new Vector2(0.0f, 0.0f); GetProperty(View.Property.SCREEN_POSITION).Get(temp); + // Dali's default layer is default center origin. need to change as top left. + // NUI's Layer is like a transparent film which covers entire window. (Layer is not an actor of Dali) + // otherwise, this makes ScreenPosition as wrong value. + temp -= (Window.Instance.GetSize() * 0.5f); return temp; } } diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index d023e8e..3da5c3c 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -162,6 +162,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if(Window.Instance != null) { + this.SetParentOrigin(Tizen.NUI.ParentOrigin.TopLeft); this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions); } @@ -178,7 +179,12 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - + internal void SetParentOrigin(Vector3 origin) + { + NDalicPINVOKE.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } /// /// Downcasts a handle to layer handle. diff --git a/src/Tizen.NUI/src/public/NUIApplication.cs b/src/Tizen.NUI/src/public/NUIApplication.cs index a79785e..3b70b65 100755 --- a/src/Tizen.NUI/src/public/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -172,6 +172,13 @@ namespace Tizen.NUI DisposeQueue disposeQ = DisposeQueue.Instance; disposeQ.Initialize(); base.OnCreate(); + + // Dali's default layer is default center origin. need to change as top left. + // NUI's Layer is like a transparent film which covers entire window. (Layer is not an actor of Dali) + // otherwise, this makes ScreenPosition as wrong value. + Layer defaultLayer = Window.GetDefaultLayer(); + defaultLayer.SetParentOrigin(Tizen.NUI.ParentOrigin.TopLeft); + defaultLayer.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); } /// -- 2.7.4