[NUI] respect GridLayout child margin (#1825)
authorYeongJong Lee <cleanlyj@naver.com>
Wed, 15 Jul 2020 05:29:36 +0000 (14:29 +0900)
committerGitHub <noreply@github.com>
Wed, 15 Jul 2020 05:29:36 +0000 (14:29 +0900)
GridLayout child margin was ignored...

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

index 2a08c1b..1809887 100755 (executable)
@@ -258,8 +258,8 @@ namespace Tizen.NUI
 
                 MeasureChildWithMargins(item, widthMeasureSpec, new LayoutLength(0), heightMeasureSpec, new LayoutLength(0));
                 gridChildren[i] = new GridChild(item,
-                                                new Node(column, columnSpan, item.MeasuredWidth.Size.AsDecimal(), horizontalStretch),
-                                                new Node(row, rowSpan, item.MeasuredHeight.Size.AsDecimal(), verticalStretch));
+                                                new Node(column, columnSpan, item.MeasuredWidth.Size.AsDecimal() + item.Owner.Margin.Start + item.Owner.Margin.End, horizontalStretch),
+                                                new Node(row, rowSpan, item.MeasuredHeight.Size.AsDecimal() + item.Owner.Margin.Top + item.Owner.Margin.Bottom, verticalStretch));
             }
         }
 
index e78dd0b..228f032 100755 (executable)
@@ -399,10 +399,10 @@ namespace Tizen.NUI
                 int row = child.Row.Start;
                 int columnEnd = child.Column.End;
                 int rowEnd = child.Row.End;
-                float l = hLocations[column] + Padding.Start;
-                float t = vLocations[row] + Padding.Top;
-                float width = hLocations[columnEnd] - hLocations[column] - ColumnSpacing;
-                float height = vLocations[rowEnd] - vLocations[row] - RowSpacing;
+                float l = hLocations[column] + Padding.Start + view.Margin.Start;
+                float t = vLocations[row] + Padding.Top + view.Margin.Top;
+                float width = hLocations[columnEnd] - hLocations[column] - ColumnSpacing - view.Margin.Start - view.Margin.End;
+                float height = vLocations[rowEnd] - vLocations[row] - RowSpacing - view.Margin.Top - view.Margin.Bottom;
 
                 if (!child.Column.Stretch.HasFlag(StretchFlags.Fill))
                 {