Ejemplo n.º 1
0
        protected virtual void FoldoutButton(Rect foldoutRect, TreeViewItem item, int row, GUIStyle foldoutStyle)
        {
            TreeViewItemExpansionAnimator expansionAnimator = this.m_TreeView.expansionAnimator;

            EditorGUI.BeginChangeCheck();
            bool expand;

            if (expansionAnimator.IsAnimating(item.id))
            {
                Matrix4x4 matrix = GUI.matrix;
                float     num    = Mathf.Min(1f, expansionAnimator.expandedValueNormalized * 2f);
                float     angle;
                if (!expansionAnimator.isExpanding)
                {
                    angle = num * 90f;
                }
                else
                {
                    angle = (1f - num) * -90f;
                }
                GUIUtility.RotateAroundPivot(angle, foldoutRect.center);
                bool isExpanding = expansionAnimator.isExpanding;
                expand     = GUI.Toggle(foldoutRect, isExpanding, GUIContent.none, foldoutStyle);
                GUI.matrix = matrix;
            }
            else
            {
                expand = GUI.Toggle(foldoutRect, this.m_TreeView.data.IsExpanded(item), GUIContent.none, foldoutStyle);
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.m_TreeView.UserInputChangedExpandedState(item, row, expand);
            }
        }
Ejemplo n.º 2
0
        protected virtual void FoldoutButton(Rect foldoutRect, TreeViewItem item, int row, GUIStyle foldoutStyle)
        {
            TreeViewItemExpansionAnimator expansionAnimator = this.m_TreeView.expansionAnimator;

            EditorGUI.BeginChangeCheck();
            bool value  = (!expansionAnimator.IsAnimating(item.id)) ? this.m_TreeView.data.IsExpanded(item) : expansionAnimator.isExpanding;
            bool expand = GUI.Toggle(foldoutRect, value, GUIContent.none, foldoutStyle);

            if (EditorGUI.EndChangeCheck())
            {
                this.m_TreeView.UserInputChangedExpandedState(item, row, expand);
            }
        }