FairyGUI.GList.GetIndexOnPos3 C# (CSharp) Method

GetIndexOnPos3() private method

private GetIndexOnPos3 ( float &pos, bool forceUpdate ) : int
pos float
forceUpdate bool
return int
        int GetIndexOnPos3(ref float pos, bool forceUpdate)
        {
            if (_realNumItems < _curLineItemCount)
            {
                pos = 0;
                return 0;
            }

            float viewWidth = this.viewWidth;
            int page = Mathf.FloorToInt(pos / viewWidth);
            int startIndex = page * (_curLineItemCount * _curLineItemCount2);
            float pos2 = page * viewWidth;
            for (int i = 0; i < _curLineItemCount; i++)
            {
                float pos3 = pos2 + _virtualItems[startIndex + i].size.x + _columnGap;
                if (pos3 > pos)
                {
                    pos = pos2;
                    return startIndex + i;
                }
                pos2 = pos3;
            }

            pos = pos2;
            return startIndex + _curLineItemCount - 1;
        }