From: neostom432 <31119276+neostom432@users.noreply.github.com> Date: Wed, 5 Feb 2020 01:55:27 +0000 (+0900) Subject: [NUI] Measure whole child in GridLayout (#1363) X-Git-Tag: submit/tizen_5.5_tv/20200206.005150~1^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6b65af8bfb17a4d82873c50f4d691aa13f7e765;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Measure whole child in GridLayout (#1363) Currently, GridLayout measures only first child for calculation so other child cannot layout its children. Now, GridLayout measures whole child so they can layout its children. Co-authored-by: agnelovaz --- diff --git a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs index fe1729d..d886faf 100755 --- a/src/Tizen.NUI/src/public/Layouting/GridLayout.cs +++ b/src/Tizen.NUI/src/public/Layouting/GridLayout.cs @@ -122,20 +122,24 @@ namespace Tizen.NUI var childCount = LayoutChildren.Count; // WIDTH SPECIFICATIONS - - // measure first child and use it's dimensions for layout measurement - if (childCount > 0) { - LayoutItem childLayoutItem = LayoutChildren[0]; - View childOwner = childLayoutItem.Owner; + foreach( LayoutItem childLayout in LayoutChildren ) + { + if( childLayout != null ) + { + MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec ); + } + } + + // Use first child's dimensions for layout measurement + View childOwner = LayoutChildren[0].Owner; - MeasureChild( childLayoutItem, widthMeasureSpec, heightMeasureSpec ); - desiredChildHeight = (int)childLayoutItem.MeasuredHeight.Size.AsRoundedValue(); - desiredChildWidth = (int)childLayoutItem.MeasuredWidth.Size.AsRoundedValue(); + desiredChildHeight = (int)LayoutChildren[0].MeasuredHeight.Size.AsRoundedValue(); + desiredChildWidth = (int)LayoutChildren[0].MeasuredWidth.Size.AsRoundedValue(); // If child has a margin then add it to desired size - Extents childMargin = childLayoutItem.Margin; + Extents childMargin = LayoutChildren[0].Margin; desiredChildHeight += childMargin.Top + childMargin.Bottom; desiredChildWidth += childMargin.Start + childMargin.End;