Ejemplo n.º 1
0
        private void DispatchMouseEnterMouseLeave(VisualElement previousTopElementUnderMouse, VisualElement currentTopElementUnderMouse, IMouseEvent triggerEvent)
        {
            if (previousTopElementUnderMouse != currentTopElementUnderMouse)
            {
                int           i = 0;
                VisualElement visualElement;
                for (visualElement = previousTopElementUnderMouse; visualElement != null; visualElement = visualElement.shadow.parent)
                {
                    i++;
                }
                int           j = 0;
                VisualElement visualElement2;
                for (visualElement2 = currentTopElementUnderMouse; visualElement2 != null; visualElement2 = visualElement2.shadow.parent)
                {
                    j++;
                }
                visualElement  = previousTopElementUnderMouse;
                visualElement2 = currentTopElementUnderMouse;
                while (i > j)
                {
                    MouseLeaveEvent pooled = MouseEventBase <MouseLeaveEvent> .GetPooled(triggerEvent);

                    pooled.target = visualElement;
                    this.DispatchEvent(pooled, visualElement.panel);
                    EventBase <MouseLeaveEvent> .ReleasePooled(pooled);

                    i--;
                    visualElement = visualElement.shadow.parent;
                }
                List <VisualElement> list = new List <VisualElement>(j);
                while (j > i)
                {
                    list.Add(visualElement2);
                    j--;
                    visualElement2 = visualElement2.shadow.parent;
                }
                while (visualElement != visualElement2)
                {
                    MouseLeaveEvent pooled2 = MouseEventBase <MouseLeaveEvent> .GetPooled(triggerEvent);

                    pooled2.target = visualElement;
                    this.DispatchEvent(pooled2, visualElement.panel);
                    EventBase <MouseLeaveEvent> .ReleasePooled(pooled2);

                    list.Add(visualElement2);
                    visualElement  = visualElement.shadow.parent;
                    visualElement2 = visualElement2.shadow.parent;
                }
                for (int k = list.Count - 1; k >= 0; k--)
                {
                    MouseEnterEvent pooled3 = MouseEventBase <MouseEnterEvent> .GetPooled(triggerEvent);

                    pooled3.target = list[k];
                    this.DispatchEvent(pooled3, list[k].panel);
                    EventBase <MouseEnterEvent> .ReleasePooled(pooled3);
                }
            }
        }
Ejemplo n.º 2
0
        public new static WheelEvent GetPooled(Event systemEvent)
        {
            WheelEvent pooled = MouseEventBase <WheelEvent> .GetPooled(systemEvent);

            pooled.imguiEvent = systemEvent;
            if (systemEvent != null)
            {
                pooled.delta = systemEvent.delta;
            }
            return(pooled);
        }
        internal static EventBase CreateEvent(Event systemEvent)
        {
            EventBase pooled;

            switch (systemEvent.type)
            {
            case EventType.MouseDown:
                pooled = MouseEventBase <MouseDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseUp:
                pooled = MouseEventBase <MouseUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseMove:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseDrag:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyDown:
                pooled = KeyboardEventBase <KeyDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyUp:
                pooled = KeyboardEventBase <KeyUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.ScrollWheel:
                pooled = WheelEvent.GetPooled(systemEvent);
                break;

            default:
                pooled = IMGUIEvent.GetPooled(systemEvent);
                break;
            }
            return(pooled);
        }
Ejemplo n.º 4
0
 private void DispatchMouseOverMouseOut(VisualElement previousTopElementUnderMouse, VisualElement currentTopElementUnderMouse, Event triggerEvent)
 {
     if (previousTopElementUnderMouse != currentTopElementUnderMouse)
     {
         if (previousTopElementUnderMouse != null)
         {
             using (MouseOutEvent pooled = MouseEventBase <MouseOutEvent> .GetPooled(triggerEvent))
             {
                 pooled.target = previousTopElementUnderMouse;
                 this.DispatchEvent(pooled, previousTopElementUnderMouse.panel);
             }
         }
         if (currentTopElementUnderMouse != null)
         {
             using (MouseOverEvent pooled2 = MouseEventBase <MouseOverEvent> .GetPooled(triggerEvent))
             {
                 pooled2.target = currentTopElementUnderMouse;
                 this.DispatchEvent(pooled2, currentTopElementUnderMouse.panel);
             }
         }
     }
 }
Ejemplo n.º 5
0
        internal static EventBase CreateEvent(Event systemEvent)
        {
            EventType type = systemEvent.type;
            EventBase pooled;

            switch (type)
            {
            case EventType.MouseDown:
                pooled = MouseEventBase <MouseDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseUp:
                pooled = MouseEventBase <MouseUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseMove:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.MouseDrag:
                pooled = MouseEventBase <MouseMoveEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyDown:
                pooled = KeyboardEventBase <KeyDownEvent> .GetPooled(systemEvent);

                break;

            case EventType.KeyUp:
                pooled = KeyboardEventBase <KeyUpEvent> .GetPooled(systemEvent);

                break;

            case EventType.ScrollWheel:
                pooled = WheelEvent.GetPooled(systemEvent);
                break;

            default:
                if (type != EventType.MouseEnterWindow)
                {
                    if (type != EventType.MouseLeaveWindow)
                    {
                        pooled = IMGUIEvent.GetPooled(systemEvent);
                    }
                    else
                    {
                        pooled = MouseEventBase <MouseLeaveWindowEvent> .GetPooled(systemEvent);
                    }
                }
                else
                {
                    pooled = MouseEventBase <MouseEnterWindowEvent> .GetPooled(systemEvent);
                }
                break;
            }
            return(pooled);
        }