Beispiel #1
0
    public Rect GetTopLabelRect(string newLabel, int padding = 5)
    {
        // Determine how large the label will be with the text
        Vector2 labelSize = HeaderStyle.CalcSize(new GUIContent(newLabel));

        return(new Rect(Screen.width / 2 - ((labelSize.x + padding) / 2), 20 + padding, labelSize.x + padding, labelSize.y + padding));
    }
        private Vector2 HeaderContentSize()
        {
            // Manually add the icon size specified in preferences.
            // This was done because using CalcSize(HeaderContent) (with the icon set in GUIContent's image)
            // caused the nodes to be incorrectly sized when opening a tree from the inspector.
            // e.g. Clicking on a GameObjects tree asset from Bonsai Tree Component.
            float   iconSize = BonsaiPreferences.Instance.iconSize;
            Vector2 size     = HeaderStyle.CalcSize(new GUIContent(HeaderText()));

            return(new Vector2(size.x + iconSize, Mathf.Max(size.y, iconSize)));
        }