Exemplo n.º 1
0
        protected internal override void PostDispatch(IPanel panel)
        {
            if (panel.ShouldSendCompatibilityMouseEvents(this))
            {
                if (imguiEvent != null && imguiEvent.rawType == EventType.MouseDown)
                {
                    using (var evt = MouseDownEvent.GetPooled(this))
                    {
                        evt.target = target;
                        evt.target.SendEvent(evt);
                    }
                }
                else if (imguiEvent != null && imguiEvent.rawType == EventType.MouseUp)
                {
                    using (var evt = MouseUpEvent.GetPooled(this))
                    {
                        evt.target = target;
                        evt.target.SendEvent(evt);
                    }
                }
                else
                {
                    using (var evt = MouseMoveEvent.GetPooled(this))
                    {
                        evt.target = target;
                        evt.target.SendEvent(evt);
                    }
                }
            }

            base.PostDispatch(panel);
        }
Exemplo n.º 2
0
        // In order for tests to run without an EditorWindow but still be able to send
        // events, we sometimes need to force the event type. IMGUI::GetEventType() (native) will
        // return the event type as Ignore if the proper views haven't yet been
        // initialized. This (falsely) breaks tests that rely on the event type. So for tests, we
        // just ensure the event type is what we originally set it to when we sent it.
        internal static EventBase CreateEvent(Event systemEvent, EventType eventType)
        {
            switch (eventType)
            {
            case EventType.MouseMove:
                return(MouseMoveEvent.GetPooled(systemEvent));

            case EventType.MouseDrag:
                return(MouseMoveEvent.GetPooled(systemEvent));

            case EventType.MouseDown:
                return(MouseDownEvent.GetPooled(systemEvent));

            case EventType.MouseUp:
                return(MouseUpEvent.GetPooled(systemEvent));

            case EventType.ContextClick:
                return(ContextClickEvent.GetPooled(systemEvent));

            case EventType.MouseEnterWindow:
                return(MouseEnterWindowEvent.GetPooled(systemEvent));

            case EventType.MouseLeaveWindow:
                return(MouseLeaveWindowEvent.GetPooled(systemEvent));

            case EventType.ScrollWheel:
                return(WheelEvent.GetPooled(systemEvent));

            case EventType.KeyDown:
                return(KeyDownEvent.GetPooled(systemEvent));

            case EventType.KeyUp:
                return(KeyUpEvent.GetPooled(systemEvent));

            case EventType.DragUpdated:
                return(DragUpdatedEvent.GetPooled(systemEvent));

            case EventType.DragPerform:
                return(DragPerformEvent.GetPooled(systemEvent));

            case EventType.DragExited:
                return(DragExitedEvent.GetPooled(systemEvent));

            case EventType.ValidateCommand:
                return(ValidateCommandEvent.GetPooled(systemEvent));

            case EventType.ExecuteCommand:
                return(ExecuteCommandEvent.GetPooled(systemEvent));

            default:    // Layout, Ignore, Used
                return(IMGUIEvent.GetPooled(systemEvent));
            }
        }
Exemplo n.º 3
0
        protected internal override void PostDispatch(IPanel panel)
        {
            if (!isDefaultPrevented)
            {
                if (panel.ShouldSendCompatibilityMouseEvents(this))
                {
                    using (var evt = MouseDownEvent.GetPooled(this))
                    {
                        evt.target = target;
                        evt.target.SendEvent(evt);
                    }
                }
            }
            else
            {
                panel.PreventCompatibilityMouseEvents(pointerId);
            }

            base.PostDispatch(panel);
        }
        protected internal override void PostDispatch(IPanel panel)
        {
            bool flag = !base.isDefaultPrevented;

            if (flag)
            {
                bool flag2 = panel.ShouldSendCompatibilityMouseEvents(this);
                if (flag2)
                {
                    using (MouseDownEvent pooled = MouseDownEvent.GetPooled(this))
                    {
                        pooled.target = base.target;
                        pooled.target.SendEvent(pooled);
                    }
                }
            }
            else
            {
                panel.PreventCompatibilityMouseEvents(base.pointerId);
            }
            base.PostDispatch(panel);
        }
        protected internal override void PostDispatch(IPanel panel)
        {
            bool flag = panel.ShouldSendCompatibilityMouseEvents(this);

            if (flag)
            {
                bool flag2 = base.imguiEvent != null && base.imguiEvent.rawType == EventType.MouseDown;
                if (flag2)
                {
                    using (MouseDownEvent pooled = MouseDownEvent.GetPooled(this))
                    {
                        pooled.target = base.target;
                        pooled.target.SendEvent(pooled);
                    }
                }
                else
                {
                    bool flag3 = base.imguiEvent != null && base.imguiEvent.rawType == EventType.MouseUp;
                    if (flag3)
                    {
                        using (MouseUpEvent pooled2 = MouseUpEvent.GetPooled(this))
                        {
                            pooled2.target = base.target;
                            pooled2.target.SendEvent(pooled2);
                        }
                    }
                    else
                    {
                        using (MouseMoveEvent pooled3 = MouseMoveEvent.GetPooled(this))
                        {
                            pooled3.target = base.target;
                            pooled3.target.SendEvent(pooled3);
                        }
                    }
                }
            }
            base.PostDispatch(panel);
        }