예제 #1
0
        internal void UpdateElementUnderPointers()
        {
            foreach (var pointerId in PointerId.hoveringPointers)
            {
                if (PointerDeviceState.GetPanel(pointerId) != this)
                {
                    SetElementUnderPointer(null, pointerId);
                }
                else
                {
                    VisualElement elementUnderPointer = Pick(PointerDeviceState.GetPointerPosition(pointerId));
                    SetElementUnderPointer(elementUnderPointer, pointerId);
                }
            }

            CommitElementUnderPointers();
        }
예제 #2
0
        internal void UpdateElementUnderPointers()
        {
            foreach (var pointerId in PointerId.hoveringPointers)
            {
                if (PointerDeviceState.GetPanel(pointerId) != this)
                {
                    SetElementUnderPointer(null, pointerId, new Vector2(float.MinValue, float.MinValue));
                }
                else
                {
                    var pointerPos = PointerDeviceState.GetPointerPosition(pointerId);
                    // Here it's important to call PickAll instead of Pick to ensure we don't use the cached value.
                    VisualElement elementUnderPointer = PickAll(pointerPos, null);
                    SetElementUnderPointer(elementUnderPointer, pointerId, pointerPos);
                }
            }

            CommitElementUnderPointers();
        }
 internal void UpdateElementUnderPointers()
 {
     int[] hoveringPointers = PointerId.hoveringPointers;
     for (int i = 0; i < hoveringPointers.Length; i++)
     {
         int  pointerId = hoveringPointers[i];
         bool flag      = PointerDeviceState.GetPanel(pointerId) != this;
         if (flag)
         {
             this.SetElementUnderPointer(null, pointerId, new Vector2(-3.40282347E+38f, -3.40282347E+38f));
         }
         else
         {
             Vector2       pointerPosition        = PointerDeviceState.GetPointerPosition(pointerId);
             VisualElement newElementUnderPointer = this.PickAll(pointerPosition, null);
             this.SetElementUnderPointer(newElementUnderPointer, pointerId, pointerPosition);
         }
     }
     this.CommitElementUnderPointers();
 }
예제 #4
0
        internal void CommitElementUnderPointers(EventDispatcher dispatcher)
        {
            for (int i = 0; i < this.m_TopElementUnderPointer.Length; i++)
            {
                IPointerEvent pointerEvent   = this.m_TriggerPointerEvent[i];
                VisualElement visualElement  = this.m_TopElementUnderPointer[i];
                VisualElement visualElement2 = this.m_PendingTopElementUnderPointer[i];
                bool          flag           = visualElement2 == visualElement;
                if (flag)
                {
                    bool flag2 = pointerEvent != null;
                    if (flag2)
                    {
                        Vector3 position = pointerEvent.position;
                        this.m_PickingPointerPositions[i] = new Vector2(position.x, position.y);
                    }
                    else
                    {
                        bool flag3 = this.m_TriggerMouseEvent[i] != null;
                        if (flag3)
                        {
                            this.m_PickingPointerPositions[i] = this.m_TriggerMouseEvent[i].mousePosition;
                        }
                    }
                }
                else
                {
                    this.m_TopElementUnderPointer[i] = visualElement2;
                    bool flag4 = pointerEvent == null && this.m_TriggerMouseEvent[i] == null;
                    if (flag4)
                    {
                        using (new EventDispatcherGate(dispatcher))
                        {
                            Vector2 pointerPosition = PointerDeviceState.GetPointerPosition(i);
                            PointerEventsHelper.SendOverOut(visualElement, visualElement2, null, pointerPosition, i);
                            PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>(visualElement, visualElement2, null, pointerPosition, i);
                            this.m_PickingPointerPositions[i] = pointerPosition;
                            bool flag5 = i == PointerId.mousePointerId;
                            if (flag5)
                            {
                                MouseEventsHelper.SendMouseOverMouseOut(visualElement, visualElement2, null, pointerPosition);
                                MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>(visualElement, visualElement2, null, pointerPosition);
                            }
                        }
                    }
                    bool flag6 = pointerEvent != null;
                    if (flag6)
                    {
                        Vector3 position2 = pointerEvent.position;
                        this.m_PickingPointerPositions[i] = new Vector2(position2.x, position2.y);
                        EventBase eventBase = pointerEvent as EventBase;
                        bool      flag7     = eventBase != null && (eventBase.eventTypeId == EventBase <PointerMoveEvent> .TypeId() || eventBase.eventTypeId == EventBase <PointerDownEvent> .TypeId() || eventBase.eventTypeId == EventBase <PointerUpEvent> .TypeId() || eventBase.eventTypeId == EventBase <PointerCancelEvent> .TypeId());
                        if (flag7)
                        {
                            using (new EventDispatcherGate(dispatcher))
                            {
                                PointerEventsHelper.SendOverOut(visualElement, visualElement2, pointerEvent, position2, i);
                                PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>(visualElement, visualElement2, pointerEvent, position2, i);
                            }
                        }
                    }
                    this.m_TriggerPointerEvent[i] = null;
                    IMouseEvent mouseEvent = this.m_TriggerMouseEvent[i];
                    bool        flag8      = mouseEvent != null;
                    if (flag8)
                    {
                        Vector2 mousePosition = mouseEvent.mousePosition;
                        this.m_PickingPointerPositions[i] = mousePosition;
                        EventBase eventBase2 = mouseEvent as EventBase;
                        bool      flag9      = eventBase2 != null;
                        if (flag9)
                        {
                            bool flag10 = eventBase2.eventTypeId == EventBase <MouseMoveEvent> .TypeId() || eventBase2.eventTypeId == EventBase <MouseDownEvent> .TypeId() || eventBase2.eventTypeId == EventBase <MouseUpEvent> .TypeId() || eventBase2.eventTypeId == EventBase <WheelEvent> .TypeId();

                            if (flag10)
                            {
                                using (new EventDispatcherGate(dispatcher))
                                {
                                    MouseEventsHelper.SendMouseOverMouseOut(visualElement, visualElement2, mouseEvent, mousePosition);
                                    MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>(visualElement, visualElement2, mouseEvent, mousePosition);
                                }
                            }
                            else
                            {
                                bool flag11 = eventBase2.eventTypeId == EventBase <MouseEnterWindowEvent> .TypeId() || eventBase2.eventTypeId == EventBase <MouseLeaveWindowEvent> .TypeId();

                                if (flag11)
                                {
                                    using (new EventDispatcherGate(dispatcher))
                                    {
                                        PointerEventsHelper.SendOverOut(visualElement, visualElement2, null, mousePosition, i);
                                        PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>(visualElement, visualElement2, null, mousePosition, i);
                                        bool flag12 = i == PointerId.mousePointerId;
                                        if (flag12)
                                        {
                                            MouseEventsHelper.SendMouseOverMouseOut(visualElement, visualElement2, mouseEvent, mousePosition);
                                            MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>(visualElement, visualElement2, mouseEvent, mousePosition);
                                        }
                                    }
                                }
                                else
                                {
                                    bool flag13 = eventBase2.eventTypeId == EventBase <DragUpdatedEvent> .TypeId() || eventBase2.eventTypeId == EventBase <DragExitedEvent> .TypeId();

                                    if (flag13)
                                    {
                                        using (new EventDispatcherGate(dispatcher))
                                        {
                                            PointerEventsHelper.SendOverOut(visualElement, visualElement2, null, mousePosition, i);
                                            PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>(visualElement, visualElement2, null, mousePosition, i);
                                            MouseEventsHelper.SendMouseOverMouseOut(visualElement, visualElement2, mouseEvent, mousePosition);
                                            MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>(visualElement, visualElement2, mouseEvent, mousePosition);
                                            MouseEventsHelper.SendEnterLeave <DragLeaveEvent, DragEnterEvent>(visualElement, visualElement2, mouseEvent, mousePosition);
                                        }
                                    }
                                }
                            }
                        }
                        this.m_TriggerMouseEvent[i] = null;
                    }
                }
            }
        }