UnityEditor.PopupLocationHelper.GetLargestRect C# (CSharp) Method

GetLargestRect() private static method

private static GetLargestRect ( List rects ) : Rect
rects List
return UnityEngine.Rect
        private static Rect GetLargestRect(List<Rect> rects)
        {
            Rect rect = new Rect();
            foreach (Rect rect2 in rects)
            {
                if ((rect2.height * rect2.width) > (rect.height * rect.width))
                {
                    rect = rect2;
                }
            }
            return rect;
        }

Usage Example

示例#1
0
        public static Rect GetDropDownRect(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, PopupLocationHelper.PopupLocation[] locationPriorityOrder)
        {
            if (locationPriorityOrder == null)
            {
                locationPriorityOrder = new PopupLocationHelper.PopupLocation[2]
                {
                    PopupLocationHelper.PopupLocation.Below,
                    PopupLocationHelper.PopupLocation.Above
                }
            }
            ;
            List <Rect> rects = new List <Rect>();
            Rect        resultRect;

            foreach (int num in locationPriorityOrder)
            {
                switch (num)
                {
                case 0:
                    if (PopupLocationHelper.PopupBelow(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 1:
                    if (PopupLocationHelper.PopupAbove(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 2:
                    if (PopupLocationHelper.PopupLeft(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;

                case 3:
                    if (PopupLocationHelper.PopupRight(buttonRect, minSize, maxSize, popupContainerWindow, out resultRect))
                    {
                        return(resultRect);
                    }
                    rects.Add(resultRect);
                    break;
                }
            }
            return(PopupLocationHelper.GetLargestRect(rects));
        }
All Usage Examples Of UnityEditor.PopupLocationHelper::GetLargestRect