FairyGUI.GList.HandleAlign C# (CSharp) Method

HandleAlign() private method

private HandleAlign ( float contentWidth, float contentHeight ) : void
contentWidth float
contentHeight float
return void
        private void HandleAlign(float contentWidth, float contentHeight)
        {
            Vector2 newOffset = Vector2.zero;
            if (_layout == ListLayoutType.SingleColumn || _layout == ListLayoutType.FlowHorizontal || _layout == ListLayoutType.Pagination)
            {
                if (contentHeight < viewHeight)
                {
                    if (_verticalAlign == VertAlignType.Middle)
                        newOffset.y = (int)((viewHeight - contentHeight) / 2);
                    else if (_verticalAlign == VertAlignType.Bottom)
                        newOffset.y = viewHeight - contentHeight;
                }
            }
            else
            {
                if (contentWidth < this.viewWidth)
                {
                    if (_align == AlignType.Center)
                        newOffset.x = (int)((viewWidth - contentWidth) / 2);
                    else if (_align == AlignType.Right)
                        newOffset.x = viewWidth - contentWidth;
                }
            }

            if (newOffset != _alignOffset)
            {
                _alignOffset = newOffset;
                if (scrollPane != null)
                    scrollPane.AdjustMaskContainer();
                else
                    container.SetXY(_margin.left + _alignOffset.x, _margin.top + _alignOffset.y);
            }
        }