UnityEditor.PopupLocationHelper.PopupBelow C# (CSharp) Method

PopupBelow() private static method

private static PopupBelow ( Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, Rect &resultRect ) : bool
buttonRect UnityEngine.Rect
minSize UnityEngine.Vector2
maxSize UnityEngine.Vector2
popupContainerWindow ContainerWindow
resultRect UnityEngine.Rect
return bool
        private static bool PopupBelow(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect rect = new Rect(buttonRect.x, buttonRect.yMax, maxSize.x, maxSize.y);
            rect.height += k_SpaceFromBottom;
            rect = FitRect(rect, popupContainerWindow);
            float a = Mathf.Max((float) ((rect.yMax - buttonRect.yMax) - k_SpaceFromBottom), (float) 0f);
            if (a >= minSize.y)
            {
                float height = Mathf.Min(a, maxSize.y);
                resultRect = new Rect(rect.x, buttonRect.yMax, rect.width, height);
                return true;
            }
            resultRect = new Rect(rect.x, buttonRect.yMax, rect.width, a);
            return false;
        }

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::PopupBelow