private static bool DoDispatch(BaseVisualElementPanel panel)
        {
            bool result;

            if (UIElementsUtility.s_EventInstance.type == EventType.Repaint)
            {
                panel.Repaint(UIElementsUtility.s_EventInstance);
                result = (panel.IMGUIContainersCount > 0);
            }
            else
            {
                panel.ValidateLayout();
                EventBase eventBase     = UIElementsUtility.CreateEvent(UIElementsUtility.s_EventInstance);
                Vector2   mousePosition = UIElementsUtility.s_EventInstance.mousePosition;
                UIElementsUtility.s_EventDispatcher.DispatchEvent(eventBase, panel);
                UIElementsUtility.s_EventInstance.mousePosition = mousePosition;
                if (eventBase.isPropagationStopped)
                {
                    panel.visualTree.Dirty(ChangeType.Repaint);
                }
                result = eventBase.isPropagationStopped;
                UIElementsUtility.ReleaseEvent(eventBase);
            }
            return(result);
        }
Exemplo n.º 2
0
        private static bool DoDispatch(BaseVisualElementPanel panel)
        {
            bool result;

            if (UIElementsUtility.s_EventInstance.type == EventType.Repaint)
            {
                bool sRGBWrite = GL.sRGBWrite;
                if (sRGBWrite)
                {
                    GL.sRGBWrite = false;
                }
                panel.Repaint(UIElementsUtility.s_EventInstance);
                if (sRGBWrite)
                {
                    GL.sRGBWrite = true;
                }
                result = (panel.IMGUIContainersCount > 0);
            }
            else
            {
                panel.ValidateLayout();
                using (EventBase eventBase = UIElementsUtility.CreateEvent(UIElementsUtility.s_EventInstance))
                {
                    UIElementsUtility.s_EventDispatcher.DispatchEvent(eventBase, panel);
                    UIElementsUtility.s_EventInstance.mousePosition = eventBase.originalMousePosition;
                    if (eventBase.isPropagationStopped)
                    {
                        panel.visualTree.Dirty(ChangeType.Repaint);
                    }
                    result = eventBase.isPropagationStopped;
                }
            }
            return(result);
        }