[NUI] Measure opposite dimension correctly in GridLayout (#1548)
authorneostom432 <31119276+neostom432@users.noreply.github.com>
Fri, 17 Apr 2020 05:10:08 +0000 (14:10 +0900)
committerGitHub <noreply@github.com>
Fri, 17 Apr 2020 05:10:08 +0000 (14:10 +0900)
Prevously, opposite dimension of choosen grid orientation was not measured correctly.
It just followed parent's size even if measure mode is not "Exactly".

Now, following measure mode.

src/Tizen.NUI/src/public/Layouting/GridLayout.cs

index 6615cd2..92f932b 100755 (executable)
@@ -205,7 +205,6 @@ namespace Tizen.NUI
 
             var childCount = LayoutChildren.Count;
 
-            // WIDTH SPECIFICATIONS
             if (childCount > 0)
             {
                 foreach (LayoutItem childLayout in LayoutChildren)
@@ -217,9 +216,19 @@ namespace Tizen.NUI
                 }
 
                 if (_GridOrientation == Orientation.Horizontal)
+                {
                     widthSize = CalculateHorizontalSize(gridWidthMode, gridHeightMode, widthSize, heightSize);
+                    heightSize = gridWidthMode == MeasureSpecification.ModeType.Exactly?
+                                    heightSize:
+                                    (int)(LayoutChildren[0].MeasuredHeight.Size.AsDecimal() + LayoutChildren[0].Margin.Top + LayoutChildren[0].Margin.Bottom)*Rows;
+                }
                 else
+                {
+                    widthSize = gridWidthMode == MeasureSpecification.ModeType.Exactly?
+                                    heightSize:
+                                    (int)(LayoutChildren[0].MeasuredWidth.Size.AsDecimal() + LayoutChildren[0].Margin.Start + LayoutChildren[0].Margin.End)*Columns;
                     heightSize = CalculateVerticalSize(gridWidthMode, gridHeightMode, widthSize, heightSize);
+                }
 
             } // Children exists
             else