Example #1
0
        /// <summary>
        /// Draw scroolView.
        /// </summary>
        public override void OnGUIBeforeWindows()
        {
            // Create styles?
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            // Draw the background and create a gui group
            GUI.BeginGroup(position, string.Empty, s_Styles.background);

            // Opens scroolView.
            var posWithoutScrollView = position;

            if (!BehaviourMachinePrefs.showScrollView)
            {
                posWithoutScrollView.width  += 16f;
                posWithoutScrollView.height += 16f;
            }
            m_ScrollView = GUI.BeginScrollView(posWithoutScrollView, m_ScrollView, m_ViewRect);
            DrawGrid();

            // Calculate view rect?
            if (Event.current.type == EventType.Layout && StateGUI.draggedWindow != -1)
            {
                CalculateViewRect();
            }

            // Draw transitions arrows only for repaint events.
            else if (Event.current.type == EventType.Repaint && m_StatesGUI != null)
            {
                for (int i = 0; i < m_StatesGUI.Length; i++)
                {
                    m_StatesGUI[i].DrawTransitionArrows();
                }
            }
        }
Example #2
0
        /// <summary> 
        /// Draw scroolView.
        /// </summary>
        public override void OnGUIBeforeWindows () {
            // Create styles?
            if (s_Styles == null)
                s_Styles = new Styles();

            // Draw the background and create a gui group
            GUI.BeginGroup(position, string.Empty, s_Styles.background);

            // Opens scroolView.
            var posWithoutScrollView = position;
            if (!BehaviourMachinePrefs.showScrollView) {
                posWithoutScrollView.width += 16f;
                posWithoutScrollView.height += 16f;
            }
            m_ScrollView = GUI.BeginScrollView(posWithoutScrollView, m_ScrollView, m_ViewRect);
            DrawGrid();

            // Calculate view rect?
            if (Event.current.type == EventType.Layout && StateGUI.draggedWindow != -1) {
                CalculateViewRect();
            }
            
            // Draw transitions arrows only for repaint events.
            else if (Event.current.type == EventType.Repaint && m_StatesGUI != null) {
                for (int i = 0; i < m_StatesGUI.Length; i++)
                    m_StatesGUI[i].DrawTransitionArrows();
            }
        }