Beispiel #1
0
        private void OnPointerDown(PointerDownEvent evt)
        {
            if (!HasValidDataAndBindings())
            {
                return;
            }

            if (!evt.isPrimary)
            {
                return;
            }

            if (evt.button != (int)MouseButton.LeftMouse)
            {
                return;
            }

            if (evt.pointerType != PointerType.mouse)
            {
                m_TouchDownTime     = evt.timestamp;
                m_TouchDownPosition = evt.position;
                return;
            }

            DoSelect(evt.localPosition, evt.clickCount, evt.actionKey, evt.shiftKey);
        }
        /// <summary>
        /// Get the direction of the focus change for the given event. For example, when the Tab key is pressed, focus should be given to the element to the right in the focus ring.
        /// </summary>
        public FocusChangeDirection GetFocusChangeDirection(Focusable currentFocusable, EventBase e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            // FUTURE:
            // We could implement an extendable adapter system to convert event to a focus change direction.
            // This would enable new event sources to change the focus.

            if (e.eventTypeId == PointerDownEvent.TypeId())
            {
                if (focusController.GetFocusableParentForPointerEvent(e.target as Focusable, out var target))
                {
                    return(VisualElementFocusChangeTarget.GetPooled(target));
                }
            }

            if (currentFocusable is IMGUIContainer && e.imguiEvent != null)
            {
                // Let IMGUIContainer manage the focus change.
                return(FocusChangeDirection.none);
            }

            return(GetKeyDownFocusChangeDirection(e));
        }
Beispiel #3
0
        public FocusChangeDirection GetFocusChangeDirection(Focusable currentFocusable, EventBase e)
        {
            if (e.eventTypeId == PointerDownEvent.TypeId())
            {
                if (focusController.GetFocusableParentForPointerEvent(e.target as Focusable, out var target))
                {
                    return(VisualElementFocusChangeTarget.GetPooled(target));
                }
            }

            if (e.eventTypeId == NavigationMoveEvent.TypeId())
            {
                switch (((NavigationMoveEvent)e).direction)
                {
                case NavigationMoveEvent.Direction.Left: return(Left);

                case NavigationMoveEvent.Direction.Up: return(Up);

                case NavigationMoveEvent.Direction.Right: return(Right);

                case NavigationMoveEvent.Direction.Down: return(Down);

                case NavigationMoveEvent.Direction.Next: return(Next);

                case NavigationMoveEvent.Direction.Previous: return(Previous);
                }
            }

            return(FocusChangeDirection.none);
        }
 // 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 PointerMoveEvent.GetPooled(systemEvent);
         case EventType.MouseDrag:
             return PointerMoveEvent.GetPooled(systemEvent);
         case EventType.MouseDown:
             // If some buttons are already down, we generate PointerMove/MouseDown events.
             // Otherwise we generate PointerDown/MouseDown events.
             // See W3C pointer events recommendation: https://www.w3.org/TR/pointerevents2
             if (PointerDeviceState.GetPressedButtons(PointerId.mousePointerId) != 0)
             {
                 return PointerMoveEvent.GetPooled(systemEvent);
             }
             else
             {
                 return PointerDownEvent.GetPooled(systemEvent);
             }
         case EventType.MouseUp:
             // If more buttons are still down, we generate PointerMove/MouseUp events.
             // Otherwise we generate PointerUp/MouseUp events.
             // See W3C pointer events recommendation: https://www.w3.org/TR/pointerevents2
             if (PointerDeviceState.HasAdditionalPressedButtons(PointerId.mousePointerId, systemEvent.button))
             {
                 return PointerMoveEvent.GetPooled(systemEvent);
             }
             else
             {
                 return PointerUpEvent.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);
     }
 }
Beispiel #5
0
        private bool IsLocalEvent(EventBase evt)
        {
            long evtType = evt.eventTypeId;

            return(evtType == MouseDownEvent.TypeId() || evtType == MouseUpEvent.TypeId() ||
                   evtType == MouseMoveEvent.TypeId() ||
                   evtType == PointerDownEvent.TypeId() || evtType == PointerUpEvent.TypeId() ||
                   evtType == PointerMoveEvent.TypeId());
        }
Beispiel #6
0
        void OnPointerDown(PointerDownEvent evt)
        {
            m_MousePosition = m_ScrollView.WorldToLocal(evt.position);
            UpdateSelection(evt.target as VisualElement);

            if (evt.pointerId != PointerId.mousePointerId)
            {
                m_MenuContainer.panel.PreventCompatibilityMouseEvents(evt.pointerId);
            }

            evt.StopPropagation();
        }
        public void ProcessEvent(EventBase evt)
        {
            IPointerEvent pe = evt as IPointerEvent;

            if (pe == null)
            {
                return;
            }

            if (evt.eventTypeId == PointerDownEvent.TypeId() && pe.button == 0)
            {
                StartClickTracking(evt);
            }
            else if (evt.eventTypeId == PointerMoveEvent.TypeId())
            {
                // Button 1 pressed while another button was already pressed.
                if (pe.button == 0 && (pe.pressedButtons & 1) == 1)
                {
                    StartClickTracking(evt);
                }
                // Button 1 released while another button is still pressed.
                else if (pe.button == 0 && (pe.pressedButtons & 1) == 0)
                {
                    SendClickEvent(evt);
                }
                // Pointer moved or other button pressed/released
                else
                {
                    var clickStatus = m_ClickStatus[pe.pointerId];
                    if (clickStatus.m_Target != null)
                    {
                        // stop the multi-click sequence on move
                        clickStatus.m_LastPointerDownTime = 0;
                    }
                }
            }
            else if (evt.eventTypeId == PointerCancelEvent.TypeId() ||
                     evt.eventTypeId == DragUpdatedEvent.TypeId()
                     )
            {
                CancelClickTracking(evt);

                // Note that we don't cancel the click when we have a PointerStationaryEvent anymore. Touch stationary
                // events are sent on each frame where the touch doesn't move, starting immediately after the frame
                // where the touch begin event occured. If we want to cancel the ClickEvent after the touch has been
                // idle for some time, then we need to manually track the duration of the stationary phase.
            }
            else if (evt.eventTypeId == PointerUpEvent.TypeId() && pe.button == 0)
            {
                SendClickEvent(evt);
            }
        }
        public void ProcessEvent(EventBase evt)
        {
            IPointerEvent pe = evt as IPointerEvent;

            if (pe == null)
            {
                return;
            }

            if (evt.eventTypeId == PointerDownEvent.TypeId() && pe.button == 0)
            {
                StartClickTracking(evt);
            }
            else if (evt.eventTypeId == PointerMoveEvent.TypeId())
            {
                // Button 1 pressed while another button was already pressed.
                if (pe.button == 0 && (pe.pressedButtons & 1) == 1)
                {
                    StartClickTracking(evt);
                }
                // Button 1 released while another button is still pressed.
                else if (pe.button == 0 && (pe.pressedButtons & 1) == 0)
                {
                    SendClickEvent(evt);
                }
                // Pointer moved or other button pressed/released
                else
                {
                    var clickStatus = m_ClickStatus[pe.pointerId];
                    if (clickStatus.m_Target != null)
                    {
                        // stop the multi-click sequence on move
                        clickStatus.m_LastPointerDownTime = 0;
                    }
                }
            }
            else if (evt.eventTypeId == PointerCancelEvent.TypeId() ||
                     evt.eventTypeId == PointerStationaryEvent.TypeId()
#if UNITY_EDITOR
                     || evt.eventTypeId == DragUpdatedEvent.TypeId()
#endif
                     )
            {
                CancelClickTracking(evt);
            }
            else if (evt.eventTypeId == PointerUpEvent.TypeId() && pe.button == 0)
            {
                SendClickEvent(evt);
            }
        }
        private void OnPointerDownEvent(PointerDownEvent evt)
        {
            if (evt.button != (int)MouseButton.LeftMouse)
            {
                m_DragState = DragState.None;
                return;
            }

            if (CanStartDrag(evt.position))
            {
                m_DragState = DragState.CanStartDrag;
                m_Start     = evt.position;
            }
        }
        protected void OnPointerDown(PointerDownEvent evt)
        {
            if (!CanStartManipulation(evt))
            {
                return;
            }

            if (IsNotMouseEvent(evt))
            {
                ProcessDownEvent(evt, evt.localPosition, evt.pointerId);
                evt.PreventDefault();
            }
            else
            {
                evt.StopImmediatePropagation();
            }
        }
        private void OnPointerDownEvent(PointerDownEvent evt)
        {
            bool flag = evt.button != 0;

            if (flag)
            {
                this.m_CanStartDrag = false;
            }
            else
            {
                bool flag2 = this.CanStartDrag(evt.position);
                if (flag2)
                {
                    this.m_CanStartDrag = true;
                    this.m_Start        = evt.position;
                }
            }
        }
Beispiel #12
0
 private void UpdateValueOnPointerDown(PointerDownEvent evt)
 {
     if (CanStartDrag(evt.button, evt.localPosition))
     {
         // We want to allow dragging when using a mouse in any context and when in an Editor context with any pointer type.
         if (evt.pointerType == PointerType.mouse)
         {
             m_DragElement.CaptureMouse();
             ProcessDownEvent(evt);
         }
         else if (m_DragElement.panel.contextType == ContextType.Editor)
         {
             evt.PreventDefault();
             m_DragElement.CapturePointer(evt.pointerId);
             ProcessDownEvent(evt);
         }
     }
 }
        protected void OnPointerDown(PointerDownEvent evt)
        {
            bool flag = !base.CanStartManipulation(evt);

            if (!flag)
            {
                bool flag2 = evt.pointerId != PointerId.mousePointerId;
                if (flag2)
                {
                    this.ProcessDownEvent(evt, evt.localPosition, evt.pointerId);
                    evt.PreventDefault();
                }
                else
                {
                    evt.StopImmediatePropagation();
                }
            }
        }
Beispiel #14
0
        private void OnPointerDown(PointerDownEvent evt)
        {
            bool flag = evt.pointerType != PointerType.mouse && evt.isPrimary && this.m_ScrollingPointerId == PointerId.invalidPointerId;

            if (flag)
            {
                IVisualElementScheduledItem expr_39 = this.m_PostPointerUpAnimation;
                if (expr_39 != null)
                {
                    expr_39.Pause();
                }
                this.m_ScrollingPointerId   = evt.pointerId;
                this.m_PointerStartPosition = evt.position;
                this.m_StartPosition        = this.scrollOffset;
                this.m_Velocity             = Vector2.zero;
                this.m_SpringBackVelocity   = Vector2.zero;
                this.m_LowBounds            = new Vector2(Mathf.Min(this.horizontalScroller.lowValue, this.horizontalScroller.highValue), Mathf.Min(this.verticalScroller.lowValue, this.verticalScroller.highValue));
                this.m_HighBounds           = new Vector2(Mathf.Max(this.horizontalScroller.lowValue, this.horizontalScroller.highValue), Mathf.Max(this.verticalScroller.lowValue, this.verticalScroller.highValue));
                evt.StopPropagation();
            }
        }
Beispiel #15
0
        /// <summary>
        /// Get the direction of the focus change for the given event. For example, when the Tab key is pressed, focus should be given to the element to the right in the focus ring.
        /// </summary>
        public FocusChangeDirection GetFocusChangeDirection(Focusable currentFocusable, EventBase e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            // FUTURE:
            // We could implement an extendable adapter system to convert event to a focus change direction.
            // This would enable new event sources to change the focus.

            if (e.eventTypeId == PointerDownEvent.TypeId())
            {
                if (focusController.GetFocusableParentForPointerEvent(e.target as Focusable, out var target))
                {
                    return(VisualElementFocusChangeTarget.GetPooled(target));
                }
            }

            if (currentFocusable is IMGUIContainer)
            {
                // Let IMGUIContainer manage the focus change.
                return(FocusChangeDirection.none);
            }

            if (e.eventTypeId == NavigationMoveEvent.TypeId())
            {
                // If navigation event was sent to an element that doesn't have the focus, ignore it.
                // This is helpful in cases where a control reacts to KeyDown and moves the focus away, in which case
                // any further equivalent navigation events should not move the focus again.

                var direction = ((NavigationMoveEvent)e).direction;
                return(direction == NavigationMoveEvent.Direction.Next ? VisualElementFocusChangeDirection.right :
                       direction == NavigationMoveEvent.Direction.Previous ? VisualElementFocusChangeDirection.left :
                       FocusChangeDirection.none);
            }

            return(FocusChangeDirection.none);
        }
Beispiel #16
0
        void OnPointerDown(PointerDownEvent evt)
        {
            if (evt.pointerType != PointerType.mouse && evt.isPrimary && m_ScrollingPointerId == PointerId.invalidPointerId)
            {
                m_PostPointerUpAnimation?.Pause();

                m_ScrollingPointerId   = evt.pointerId;
                m_PointerStartPosition = evt.position;
                m_StartPosition        = scrollOffset;
                m_Velocity             = Vector2.zero;
                m_SpringBackVelocity   = Vector2.zero;

                m_LowBounds = new Vector2(
                    Mathf.Min(horizontalScroller.lowValue, horizontalScroller.highValue),
                    Mathf.Min(verticalScroller.lowValue, verticalScroller.highValue));
                m_HighBounds = new Vector2(
                    Mathf.Max(horizontalScroller.lowValue, horizontalScroller.highValue),
                    Mathf.Max(verticalScroller.lowValue, verticalScroller.highValue));

                evt.StopPropagation();
            }
        }
 void OnPointerDownEvent(PointerDownEvent evt)
 {
     ProcessPointerDown(evt);
 }
Beispiel #18
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(PointerMoveEvent.GetPooled(systemEvent));

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

            case EventType.MouseDown:
                // If some buttons are already down, we generate PointerMove/MouseDown events.
                // Otherwise we generate PointerDown/MouseDown events.
                // See W3C pointer events recommendation: https://www.w3.org/TR/pointerevents2
                // Note: sometimes systemEvent.button is already pressed (systemEvent is processed multiple times).
                if (PointerDeviceState.HasAdditionalPressedButtons(PointerId.mousePointerId, systemEvent.button))
                {
                    return(PointerMoveEvent.GetPooled(systemEvent));
                }
                else
                {
                    return(PointerDownEvent.GetPooled(systemEvent));
                }

            case EventType.MouseUp:
                // If more buttons are still down, we generate PointerMove/MouseUp events.
                // Otherwise we generate PointerUp/MouseUp events.
                // See W3C pointer events recommendation: https://www.w3.org/TR/pointerevents2
                if (PointerDeviceState.HasAdditionalPressedButtons(PointerId.mousePointerId, systemEvent.button))
                {
                    return(PointerMoveEvent.GetPooled(systemEvent));
                }
                else
                {
                    return(PointerUpEvent.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));

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

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

            case EventType.DragExited:
                return(DragExitedEvent.GetPooled(systemEvent));
#endif
            case EventType.ValidateCommand:
                return(ValidateCommandEvent.GetPooled(systemEvent));

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

            default:    // Layout, Ignore, Used
                return(IMGUIEvent.GetPooled(systemEvent));
            }
        }
Beispiel #19
0
 internal static MouseDownEvent GetPooled(PointerDownEvent pointerEvent)
 {
     return(MouseDownEvent.MakeFromPointerEvent(pointerEvent));
 }
Beispiel #20
0
        private IEnumerator DoReplayEvents(IEnumerable <EventDebuggerEventRecord> eventBases, Action <int, int> refreshList)
        {
            var sortedEvents      = eventBases.OrderBy(e => e.timestamp).ToList();
            var sortedEventsCount = sortedEvents.Count;

            IEnumerator AwaitForNextEvent(int currentIndex)
            {
                if (currentIndex == sortedEvents.Count - 1)
                {
                    yield break;
                }

                var deltaTimestampMs = sortedEvents[currentIndex + 1].timestamp - sortedEvents[currentIndex].timestamp;

                var timeMs = 0.0f;

                while (timeMs < deltaTimestampMs)
                {
                    if (isPlaybackPaused)
                    {
                        yield return(null);
                    }
                    else
                    {
                        var time = Panel.TimeSinceStartupMs();
                        yield return(null);

                        var delta = Panel.TimeSinceStartupMs() - time;
                        timeMs += delta * playbackSpeed;
                    }
                }
            }

            for (var i = 0; i < sortedEventsCount; i++)
            {
                if (!isReplaying)
                {
                    break;
                }

                var eventBase = sortedEvents[i];
                var newEvent  = new Event
                {
                    button        = eventBase.button,
                    clickCount    = eventBase.clickCount,
                    modifiers     = eventBase.modifiers,
                    mousePosition = eventBase.mousePosition,
                };

                if (eventBase.eventTypeId == MouseMoveEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseMove;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseMove), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == MouseDownEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseDown;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseDown), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == MouseUpEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseUp;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseUp), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == ContextClickEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.ContextClick;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.ContextClick), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == MouseEnterWindowEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseEnterWindow;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseEnterWindow), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == MouseLeaveWindowEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseLeaveWindow;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseLeaveWindow), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == PointerMoveEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseMove;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseMove), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == PointerDownEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseDown;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseDown), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == PointerUpEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type = EventType.MouseUp;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.MouseUp), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == WheelEvent.TypeId() && eventBase.hasUnderlyingPhysicalEvent)
                {
                    newEvent.type  = EventType.ScrollWheel;
                    newEvent.delta = eventBase.delta;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.ScrollWheel), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == KeyDownEvent.TypeId())
                {
                    newEvent.type      = EventType.KeyDown;
                    newEvent.character = eventBase.character;
                    newEvent.keyCode   = eventBase.keyCode;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.KeyDown), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == KeyUpEvent.TypeId())
                {
                    newEvent.type      = EventType.KeyUp;
                    newEvent.character = eventBase.character;
                    newEvent.keyCode   = eventBase.keyCode;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.KeyUp), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == NavigationMoveEvent.TypeId())
                {
                    panel.dispatcher.Dispatch(NavigationMoveEvent.GetPooled(eventBase.navigationDirection, eventBase.deviceType, eventBase.modifiers), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == NavigationSubmitEvent.TypeId())
                {
                    panel.dispatcher.Dispatch(NavigationSubmitEvent.GetPooled(eventBase.deviceType, eventBase.modifiers), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == NavigationCancelEvent.TypeId())
                {
                    panel.dispatcher.Dispatch(NavigationCancelEvent.GetPooled(eventBase.deviceType, eventBase.modifiers), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == DragUpdatedEvent.TypeId())
                {
                    newEvent.type = EventType.DragUpdated;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.DragUpdated), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == DragPerformEvent.TypeId())
                {
                    newEvent.type = EventType.DragPerform;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.DragPerform), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == DragExitedEvent.TypeId())
                {
                    newEvent.type = EventType.DragExited;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.DragExited), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == ValidateCommandEvent.TypeId())
                {
                    newEvent.type        = EventType.ValidateCommand;
                    newEvent.commandName = eventBase.commandName;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.ValidateCommand), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == ExecuteCommandEvent.TypeId())
                {
                    newEvent.type        = EventType.ExecuteCommand;
                    newEvent.commandName = eventBase.commandName;
                    panel.dispatcher.Dispatch(UIElementsUtility.CreateEvent(newEvent, EventType.ExecuteCommand), panel,
                                              DispatchMode.Default);
                }
                else if (eventBase.eventTypeId == IMGUIEvent.TypeId())
                {
                    Debug.Log("Skipped IMGUI event (" + eventBase.eventBaseName + "): " + eventBase);
                    var awaitSkipped = AwaitForNextEvent(i);
                    while (awaitSkipped.MoveNext())
                    {
                        yield return(null);
                    }
                    continue;
                }
                else
                {
                    Debug.Log("Skipped event (" + eventBase.eventBaseName + "): " + eventBase);
                    var awaitSkipped = AwaitForNextEvent(i);
                    while (awaitSkipped.MoveNext())
                    {
                        yield return(null);
                    }
                    continue;
                }

                refreshList?.Invoke(i, sortedEventsCount);

                Debug.Log($"Replayed event {eventBase.eventId.ToString()} ({eventBase.eventBaseName}): {newEvent}");
                var await = AwaitForNextEvent(i);
                while (await.MoveNext())
                {
                    yield return(null);
                }
            }

            isReplaying = false;
        }