[NUI] temporary fix! fix wrong value of screen position in object dump 71/162771/1
authordongsug.song <dongsug.song@samsung.com>
Mon, 27 Nov 2017 14:38:05 +0000 (23:38 +0900)
committerhuiyu,eun <huiyu.eun@samsung.com>
Tue, 5 Dec 2017 07:51:18 +0000 (16:51 +0900)
- This is temporary fix, just NUI workaround, will be removed later.

Change-Id: Ia17fb4cff3f9c2a063108b69dafc6df3448d00c1
Signed-off-by: dongsug.song <dongsug.song@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs [changed mode: 0644->0755]
src/Tizen.NUI/src/public/Layer.cs
src/Tizen.NUI/src/public/NUIApplication.cs

old mode 100644 (file)
new mode 100755 (executable)
index e8acbd5..e91526c
@@ -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;
             }
         }
index d023e8e..3da5c3c 100755 (executable)
@@ -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();
+        }
 
         /// <summary>
         /// Downcasts a handle to layer handle.
index a79785e..3b70b65 100755 (executable)
@@ -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);
         }
 
         /// <summary>