[NUI] Modify Menu to help customizing class
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Thu, 27 Oct 2022 10:41:34 +0000 (19:41 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 2 Nov 2022 09:06:47 +0000 (18:06 +0900)
To help application to customize Menu, Menu's size calculation should be
modified not to set its size to its Content's size.

src/Tizen.NUI.Components/Controls/Menu.cs

index 351f5eb..d6ee226 100755 (executable)
@@ -528,26 +528,11 @@ namespace Tizen.NUI.Components
 
         private void CalculateSizeAndPosition()
         {
-            CalculateMenuSize();
-
             CalculateMenuPosition();
 
             CalculateScrimPosition();
         }
 
-        // Calculate menu's size based on content's size
-        private void CalculateMenuSize()
-        {
-            if (Content == null)
-            {
-                return;
-            }
-            if (Size.Equals(Content.Size) == false)
-            {
-                Size = new Size(Content.SizeWidth, Content.SizeHeight);
-            }
-        }
-
         private View GetRootView()
         {
             View root = this;
@@ -642,7 +627,11 @@ namespace Tizen.NUI.Components
             if (menuScreenPosX < 0)
             {
                 menuScreenPosX = 0;
-                menuSizeW = Window.Size.Width;
+
+                if (menuSizeW > Window.Size.Width)
+                {
+                    menuSizeW = Window.Size.Width;
+                }
             }
 
             // Check if menu is not inside parent's boundary in y coordinate system.
@@ -660,7 +649,11 @@ namespace Tizen.NUI.Components
             if (menuScreenPosY < 0)
             {
                 menuScreenPosY = 0;
-                menuSizeH = Window.Size.Height;
+
+                if (menuSizeH > Window.Size.Height)
+                {
+                    menuSizeH = Window.Size.Height;
+                }
             }
 
             // Position is relative to parent's coordinate system.