UnityEngine.UI.HorizontalOrVerticalLayoutGroup.CalcAlongAxis C# (CSharp) Method

CalcAlongAxis() protected method

Calculate the layout element properties for this layout element along the given axis.

protected CalcAlongAxis ( int axis, bool isVertical ) : void
axis int The axis to calculate for. 0 is horizontal and 1 is vertical.
isVertical bool Is this group a vertical group?
return void
        protected void CalcAlongAxis(int axis, bool isVertical)
        {
            float num = (axis != 0) ? ((float) base.padding.vertical) : ((float) base.padding.horizontal);
            bool controlSize = (axis != 0) ? this.m_ChildControlHeight : this.m_ChildControlWidth;
            bool childForceExpand = (axis != 0) ? this.childForceExpandHeight : this.childForceExpandWidth;
            float b = num;
            float num3 = num;
            float num4 = 0f;
            bool flag3 = isVertical ^ (axis == 1);
            for (int i = 0; i < base.rectChildren.Count; i++)
            {
                float num6;
                float num7;
                float num8;
                RectTransform child = base.rectChildren[i];
                this.GetChildSizes(child, axis, controlSize, childForceExpand, out num6, out num7, out num8);
                if (flag3)
                {
                    b = Mathf.Max(num6 + num, b);
                    num3 = Mathf.Max(num7 + num, num3);
                    num4 = Mathf.Max(num8, num4);
                }
                else
                {
                    b += num6 + this.spacing;
                    num3 += num7 + this.spacing;
                    num4 += num8;
                }
            }
            if (!flag3 && (base.rectChildren.Count > 0))
            {
                b -= this.spacing;
                num3 -= this.spacing;
            }
            num3 = Mathf.Max(b, num3);
            base.SetLayoutInputForAxis(b, num3, num4, axis);
        }