[NUI] Fix ConvertidToView issue (#890)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Wed, 19 Jun 2019 00:49:48 +0000 (09:49 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 19 Jun 2019 00:49:48 +0000 (09:49 +0900)
* [NUI] Fix ConvertIdToView (#877)

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Fix ConvertIdToView issue

If we can't find the parent's children, find in the top layer.

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Container.cs
src/Tizen.NUI/src/public/Layer.cs

index 883a1b8..feed447 100755 (executable)
@@ -4611,6 +4611,11 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
+        internal override View FindCurrentChildById(uint id)
+        {
+            return FindChildById(id);
+        }
+
         internal void SetParentOrigin(Vector3 origin)
         {
             Interop.ActorInternal.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin));
@@ -5595,16 +5600,21 @@ namespace Tizen.NUI.BaseComponents
 
         private View ConvertIdToView(uint id)
         {
-            View view = null;
-            if (GetParent() is View)
-            {
-                View parentView = GetParent() as View;
-                view = parentView.FindChildById(id);
-            }
+            View view = GetParent()?.FindCurrentChildById(id);
 
-            if (!view)
+            //If we can't find the parent's children, find in the top layer.
+            if (!view) 
             {
-                view = Window.Instance.GetRootLayer().FindChildById(id);
+                Container parent = GetParent();
+                while ((parent is View) && (parent != null))
+                {
+                    parent = parent.GetParent();
+                    if (parent is Layer)
+                    {
+                        view = parent.FindCurrentChildById(id);
+                        break;
+                    }
+                }
             }
 
             return view;
index 2c05dc6..4971a4e 100755 (executable)
@@ -135,5 +135,7 @@ namespace Tizen.NUI
             base.Dispose(type);
         }
 
+        internal abstract View FindCurrentChildById(uint id);
+
     }
 } // namespace Tizen.NUI
index cd5f370..93f698e 100755 (executable)
@@ -382,6 +382,11 @@ namespace Tizen.NUI
             return ret;
         }
 
+        internal override View FindCurrentChildById(uint id)
+        {
+            return FindChildById(id);
+        }
+
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public View FindChildByName(string viewName)