SetHorizontal() public method

public SetHorizontal ( float x, float width ) : void
x float
width float
return void
コード例 #1
0
        private static void LayoutSingleGroup(GUILayoutGroup i)
        {
            bool flag = !i.isWindow;

            if (flag)
            {
                float minWidth = i.minWidth;
                float maxWidth = i.maxWidth;
                i.CalcWidth();
                i.SetHorizontal(i.rect.x, Mathf.Clamp(i.maxWidth, minWidth, maxWidth));
                float minHeight = i.minHeight;
                float maxHeight = i.maxHeight;
                i.CalcHeight();
                i.SetVertical(i.rect.y, Mathf.Clamp(i.maxHeight, minHeight, maxHeight));
            }
            else
            {
                i.CalcWidth();
                Rect rect = GUILayoutUtility.Internal_GetWindowRect(i.windowID);
                i.SetHorizontal(rect.x, Mathf.Clamp(rect.width, i.minWidth, i.maxWidth));
                i.CalcHeight();
                i.SetVertical(rect.y, Mathf.Clamp(rect.height, i.minHeight, i.maxHeight));
                GUILayoutUtility.Internal_MoveWindow(i.windowID, i.rect);
            }
        }
コード例 #2
0
        static void LayoutSingleGroup(GUILayoutGroup i)
        {
            if (!i.isWindow)
            {
                // CalcWidth knocks out minWidth with the calculated sizes from its children. Normally, this is fine, but since we're in a fixed-size area,
                // we want to maintain that
                float origMinWidth = i.minWidth;
                float origMaxWidth = i.maxWidth;

                // Figure out the group's min & maxWidth.
                i.CalcWidth();

                // Make it as wide as possible, but the Rect supplied takes precedence...
                i.SetHorizontal(i.rect.x, Mathf.Clamp(i.maxWidth, origMinWidth, origMaxWidth));

                // Do the same preservation for CalcHeight...
                float origMinHeight = i.minHeight;
                float origMaxHeight = i.maxHeight;

                i.CalcHeight();
                // Make it as high as possible, but the Rect supplied takes precedence...
                i.SetVertical(i.rect.y, Mathf.Clamp(i.maxHeight, origMinHeight, origMaxHeight));
            }
            else
            {
                // Figure out the group's min & maxWidth.
                i.CalcWidth();

                Rect winRect = Internal_GetWindowRect(i.windowID);

                // Make it as wide as possible, but the Rect supplied takes precedence...
                i.SetHorizontal(winRect.x, Mathf.Clamp(winRect.width, i.minWidth, i.maxWidth));

                i.CalcHeight();

                // Make it as high as possible, but the Rect supplied takes precedence...
                i.SetVertical(winRect.y, Mathf.Clamp(winRect.height, i.minHeight, i.maxHeight));

                // If GUILayout did any resizing, make sure the window reflects this.

                Internal_MoveWindow(i.windowID, i.rect);
            }
        }
コード例 #3
0
 private static void LayoutSingleGroup(GUILayoutGroup i)
 {
     if (!i.isWindow)
     {
         float minWidth = i.minWidth;
         float maxWidth = i.maxWidth;
         i.CalcWidth();
         i.SetHorizontal(i.rect.x, Mathf.Clamp(i.maxWidth, minWidth, maxWidth));
         float minHeight = i.minHeight;
         float maxHeight = i.maxHeight;
         i.CalcHeight();
         i.SetVertical(i.rect.y, Mathf.Clamp(i.maxHeight, minHeight, maxHeight));
     }
     else
     {
         i.CalcWidth();
         Rect rect = Internal_GetWindowRect(i.windowID);
         i.SetHorizontal(rect.x, Mathf.Clamp(rect.width, i.minWidth, i.maxWidth));
         i.CalcHeight();
         i.SetVertical(rect.y, Mathf.Clamp(rect.height, i.minHeight, i.maxHeight));
         Internal_MoveWindow(i.windowID, i.rect);
     }
 }