UnityEditor.PopupLocationHelper.PopupLeft C# (CSharp) Method

PopupLeft() private static method

private static PopupLeft ( 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 PopupLeft(Rect buttonRect, Vector2 minSize, Vector2 maxSize, ContainerWindow popupContainerWindow, out Rect resultRect)
        {
            Rect rect = new Rect(buttonRect.x - maxSize.x, buttonRect.y, maxSize.x, maxSize.y);
            float num = 0f;
            rect.xMin -= num;
            rect.height += k_SpaceFromBottom;
            rect = FitRect(rect, popupContainerWindow);
            float a = Mathf.Max((float) ((buttonRect.x - rect.x) - num), (float) 0f);
            float width = Mathf.Min(a, maxSize.x);
            resultRect = new Rect(rect.x, rect.y, width, rect.height - k_SpaceFromBottom);
            return (a >= minSize.x);
        }

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