Ejemplo n.º 1
0
        public static void ScrollableTextArea(this Listing_Standard ls, float outerRectHeight,
                                              string text, ref Vector2 scrollViewPos, GUIStyle textStyle, float widthShrinkage = 0f)
        {
            var textSizeWidthHeight = ls.CalcHeightWidthForText(text, textStyle);

            var scrollViewHeight = Mathf.Max(textSizeWidthHeight.y, outerRectHeight);
            var scrollViewWidth  = Mathf.Max(textSizeWidthHeight.x, ls.ColumnWidth - widthShrinkage);

            var textRect       = ls.GetRect(outerRectHeight);
            var scrollViewRect = new Rect(0f, 0f, scrollViewWidth, scrollViewHeight);

            Widgets.BeginScrollView(textRect, ref scrollViewPos, scrollViewRect);
            GUI.TextArea(scrollViewRect, text, textStyle);
            Widgets.EndScrollView();
        }