[NUI] NaturalSize returns size set instead of Zero for CustomViews (#1114)
authoragnelovaz <agnelo.vaz@samsung.com>
Mon, 4 Nov 2019 06:02:44 +0000 (06:02 +0000)
committerhyunjushin <hyunjushin@samsung.com>
Mon, 4 Nov 2019 06:02:44 +0000 (15:02 +0900)
Change-Id: I3e900c09df94d19b93d35d5bf947a99cefd5337b

src/Tizen.NUI/src/public/BaseComponents/CustomView.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs

index d9fb791..8ebc36e 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -325,7 +325,7 @@ namespace Tizen.NUI.BaseComponents
         /// <since_tizen> 3 </since_tizen>
         public new virtual Size2D GetNaturalSize()
         {
-            return new Size2D(0, 0);
+            return sizeSetExplicitly;  // Returns the size set explicitly on View unless Overridden.
         }
 
         /// <summary>
index eaf413c..89e9736 100755 (executable)
@@ -58,6 +58,8 @@ namespace Tizen.NUI.BaseComponents
         private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
         private string[] transitionNames;
 
+        internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
+
         /// <summary>
         /// Creates a new instance of a view.
         /// </summary>
@@ -553,6 +555,7 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
+                sizeSetExplicitly = value;  // Store size set by API, will be used in place of NaturalSize if not set.
                 SetValue(Size2DProperty, value);
                 // Set Specification so when layouts measure this View it matches the value set here.
                 // All Views are currently Layouts.