public override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { OnMouseDown(evt as MouseDownEvent); } else if (evt.GetEventTypeId() == MouseUpEvent.TypeId()) { OnMouseUp(evt as MouseUpEvent); } else if (evt.GetEventTypeId() == MouseMoveEvent.TypeId()) { OnMouseMove(evt as MouseMoveEvent); } else if (evt.GetEventTypeId() == KeyDownEvent.TypeId()) { OnKeyDown(evt as KeyDownEvent); } else if (evt.GetEventTypeId() == ValidateCommandEvent.TypeId()) { OnValidateCommandEvent(evt as ValidateCommandEvent); } else if (evt.GetEventTypeId() == ExecuteCommandEvent.TypeId()) { OnExecuteCommandEvent(evt as ExecuteCommandEvent); } }
public override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { OnMouseDown(evt as MouseDownEvent); } else if (evt.GetEventTypeId() == MouseUpEvent.TypeId()) { OnMouseUp(evt as MouseUpEvent); } else if (evt.GetEventTypeId() == MouseMoveEvent.TypeId()) { OnMouseMove(evt as MouseMoveEvent); } else if (evt.GetEventTypeId() == KeyDownEvent.TypeId()) { OnKeyDown(evt as KeyDownEvent); } else if (evt.GetEventTypeId() == IMGUIEvent.TypeId()) { OnIMGUIEvent(evt as IMGUIEvent); } }
protected override void ExecuteDefaultAction(EventBase evt) { if (evt.eventTypeId == MouseDownEvent.TypeId()) { var e = (MouseDownEvent)evt; if ((MouseButton)e.button == MouseButton.LeftMouse && e.clickCount == 2) { if (m_Title.ContainsPoint(this.ChangeCoordinatesTo(m_Title, e.localMousePosition))) { GiveFocusToTitleEditor(); e.StopImmediatePropagation(); return; } else if (m_Contents.ContainsPoint(this.ChangeCoordinatesTo(m_Contents, e.localMousePosition))) { GiveFocusToContentsEditor(); e.StopImmediatePropagation(); return; } } } base.ExecuteDefaultAction(evt); }
public override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); long mouseEventType = MouseDownEvent.TypeId(); if (!textInputField.isReadOnly && evt.eventTypeId == mouseEventType && editorEngine.keyboardOnScreen == null) { textInputField.SyncTextEngine(); textInputField.UpdateText(editorEngine.text); editorEngine.keyboardOnScreen = TouchScreenKeyboard.Open(textInputField.text, TouchScreenKeyboardType.Default, true, // autocorrection editorEngine.multiline, textInputField.isPasswordField); if (editorEngine.keyboardOnScreen != null) { PollTouchScreenKeyboard(); } // Scroll offset might need to be updated editorEngine.UpdateScrollOffset(); evt.StopPropagation(); } }
protected internal override void ExecuteDefaultAction(EventBase evt) { base.ExecuteDefaultAction(evt); if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { OnMouseDown(); } }
public bool InterceptMouseEvent(IPanel panel, IMouseEvent ev) { if (!m_PickElement) { return(false); } var evtBase = ev as EventBase; var evtType = evtBase.eventTypeId; var target = evtBase.target as VisualElement; // Ignore events on detached elements if (panel == null) { return(false); } // Only intercept mouse clicks, MouseOverEvent and MouseEnterWindow if (evtType != MouseDownEvent.TypeId() && evtType != MouseOverEvent.TypeId() && evtType != MouseEnterWindowEvent.TypeId()) { return(false); } if (evtType == MouseDownEvent.TypeId()) { if ((ev as MouseDownEvent)?.button == (int)MouseButton.LeftMouse) { StopPicking(); } return(true); } // Ignore these events if on this debugger if (panel != rootVisualElement.panel) { if (evtType == MouseOverEvent.TypeId()) { OnPickMouseOver(target, panel); } else if (evtType == MouseEnterWindowEvent.TypeId()) { // Focus window while picking an element var mouseOverView = GUIView.mouseOverView; if (mouseOverView != null) { mouseOverView.Focus(); } } } return(false); }
protected internal override void ExecuteDefaultAction(EventBase evt) { base.ExecuteDefaultAction(evt); if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { OnCurveClick(); } else if (evt.GetEventTypeId() == DetachFromPanelEvent.TypeId()) { OnDetach(); } }
protected internal override void ExecuteDefaultAction(EventBase evt) { base.ExecuteDefaultAction(evt); if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { Focus(); } if (focusController != null) { focusController.SwitchFocusOnEvent(evt); } }
public override void DisplayMenuIfEventMatches(EventBase evt, IEventHandler eventHandler) { if (evt == null) { return; } if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { if (evt.eventTypeId == MouseDownEvent.TypeId()) { MouseDownEvent e = evt as MouseDownEvent; if (e.button == (int)MouseButton.RightMouse || (e.button == (int)MouseButton.LeftMouse && e.modifiers == EventModifiers.Control)) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); return; } } } else { if (evt.eventTypeId == MouseUpEvent.TypeId()) { MouseUpEvent e = evt as MouseUpEvent; if (e.button == (int)MouseButton.RightMouse) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); return; } } } if (evt.eventTypeId == KeyUpEvent.TypeId()) { KeyUpEvent e = evt as KeyUpEvent; if (e.keyCode == KeyCode.Menu) { DisplayMenu(evt, eventHandler); evt.StopPropagation(); } } }
protected internal override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); if (evt.GetEventTypeId() == MouseDownEvent.TypeId()) { OnMouseDown(); } else if (evt.GetEventTypeId() == IMGUIEvent.TypeId()) { OnIMGUI(evt); } else if (evt.GetEventTypeId() == MouseLeaveEvent.TypeId()) { OnMouseLeave(); } }
public override void ExecuteDefaultActionAtTarget(EventBase evt) { base.ExecuteDefaultActionAtTarget(evt); long mouseEventType = MouseDownEvent.TypeId(); if (evt.GetEventTypeId() == mouseEventType) { textInputField.SyncTextEngine(); textInputField.UpdateText(editorEngine.text); textInputField.CaptureMouse(); editorEngine.keyboardOnScreen = TouchScreenKeyboard.Open(!string.IsNullOrEmpty(secureText) ? secureText : textInputField.text, TouchScreenKeyboardType.Default, true, // autocorrection editorEngine.multiline, !string.IsNullOrEmpty(secureText)); // Scroll offset might need to be updated editorEngine.UpdateScrollOffset(); evt.StopPropagation(); } }
void DispatchEnterLeaveEvents(VisualElement previousTopElementUnderMouse, VisualElement currentTopElementUnderMouse, EventBase triggerEvent) { IMouseEvent mouseEvent = triggerEvent as IMouseEvent; if (mouseEvent == null) { return; } if (triggerEvent.GetEventTypeId() == MouseMoveEvent.TypeId() || triggerEvent.GetEventTypeId() == MouseDownEvent.TypeId() || triggerEvent.GetEventTypeId() == MouseUpEvent.TypeId() || triggerEvent.GetEventTypeId() == MouseEnterWindowEvent.TypeId() || triggerEvent.GetEventTypeId() == WheelEvent.TypeId()) { DispatchMouseEnterMouseLeave(previousTopElementUnderMouse, currentTopElementUnderMouse, mouseEvent); DispatchMouseOverMouseOut(previousTopElementUnderMouse, currentTopElementUnderMouse, mouseEvent); } else if (triggerEvent.GetEventTypeId() == DragUpdatedEvent.TypeId()) { DispatchDragEnterDragLeave(previousTopElementUnderMouse, currentTopElementUnderMouse, mouseEvent); } }
void SelectAllTypes(bool state, EventTypeSelection eventTypeSelection = EventTypeSelection.All) { foreach (KeyValuePair <long, bool> v in m_State.ToList()) { long eventTypeId = v.Key; if (eventTypeSelection == EventTypeSelection.All || (eventTypeSelection == EventTypeSelection.Mouse && (eventTypeId == MouseMoveEvent.TypeId() || eventTypeId == MouseOverEvent.TypeId() || eventTypeId == MouseDownEvent.TypeId() || eventTypeId == MouseUpEvent.TypeId() || eventTypeId == WheelEvent.TypeId() || eventTypeId == ContextClickEvent.TypeId())) || (eventTypeSelection == EventTypeSelection.Keyboard && (eventTypeId == KeyDownEvent.TypeId() || eventTypeId == KeyUpEvent.TypeId())) || (eventTypeSelection == EventTypeSelection.Drag && (eventTypeId == DragUpdatedEvent.TypeId() || eventTypeId == DragPerformEvent.TypeId() || eventTypeId == DragExitedEvent.TypeId())) || (eventTypeSelection == EventTypeSelection.Command && (eventTypeId == ValidateCommandEvent.TypeId() || eventTypeId == ExecuteCommandEvent.TypeId()))) { m_State[eventTypeId] = state; } else { // Unaffected should be reset to false m_State[eventTypeId] = false; } } UpdateValue(); }
public void DispatchEvent(EventBase evt, IPanel panel) { if (evt.GetEventTypeId() == IMGUIEvent.TypeId()) { Event e = evt.imguiEvent; if (e.type == EventType.Repaint) { return; } } if (panel != null && panel.panelDebug != null && panel.panelDebug.enabled && panel.panelDebug.interceptEvents != null) { if (panel.panelDebug.interceptEvents(evt.imguiEvent)) { evt.StopPropagation(); return; } } IMouseEvent mouseEvent = evt as IMouseEvent; IMouseEventInternal mouseEventInternal = evt as IMouseEventInternal; if (mouseEvent != null && mouseEventInternal != null && mouseEventInternal.hasUnderlyingPhysicalEvent) { m_LastMousePosition = mouseEvent.mousePosition; } bool eventHandled = false; // Release mouse capture if capture element is not in a panel. VisualElement captureVE = MouseCaptureController.mouseCapture as VisualElement; if (evt.GetEventTypeId() != MouseCaptureOutEvent.TypeId() && captureVE != null && captureVE.panel == null) { Event e = evt.imguiEvent; Debug.Log(String.Format("Capture has no panel, forcing removal (capture={0} eventType={1})", MouseCaptureController.mouseCapture, e != null ? e.type.ToString() : "null")); MouseCaptureController.ReleaseMouseCapture(); } // Send all IMGUI events (for backward compatibility) and MouseEvents with null target (because thats what we want to do in the new system) // to the capture, if there is one. Note that events coming from IMGUI have their target set to null. bool sendEventToMouseCapture = false; bool mouseEventWasCaptured = false; if (MouseCaptureController.mouseCapture != null) { if (evt.imguiEvent != null && evt.target == null) { // Non exclusive processing by capturing element. sendEventToMouseCapture = true; mouseEventWasCaptured = false; } if (mouseEvent != null && (evt.target == null || evt.target == MouseCaptureController.mouseCapture)) { // Exclusive processing by capturing element. sendEventToMouseCapture = true; mouseEventWasCaptured = true; } if (panel != null) { if (captureVE != null && captureVE.panel.contextType != panel.contextType) { // Capturing element is not in the right context. Ignore it. sendEventToMouseCapture = false; mouseEventWasCaptured = false; } } } evt.skipElement = null; if (sendEventToMouseCapture) { IEventHandler originalCaptureElement = MouseCaptureController.mouseCapture; eventHandled = true; evt.dispatch = true; evt.target = MouseCaptureController.mouseCapture; evt.currentTarget = MouseCaptureController.mouseCapture; evt.propagationPhase = PropagationPhase.AtTarget; MouseCaptureController.mouseCapture.HandleEvent(evt); // Do further processing with a target computed the usual way. // However, if mouseEventWasCaptured, the only thing remaining to do is ExecuteDefaultAction, // which whould be done with mouseCapture as the target. if (!mouseEventWasCaptured) { evt.target = null; } evt.currentTarget = null; evt.propagationPhase = PropagationPhase.None; evt.dispatch = false; // Do not call HandleEvent again for this element. evt.skipElement = originalCaptureElement; } if (!mouseEventWasCaptured && !evt.isPropagationStopped) { if (evt is IKeyboardEvent && panel != null) { eventHandled = true; if (panel.focusController.focusedElement != null) { IMGUIContainer imguiContainer = panel.focusController.focusedElement as IMGUIContainer; if (imguiContainer != null) { // THINK ABOUT THIS PF: shoudln't we allow for the capture dispatch phase? if (imguiContainer != evt.skipElement && imguiContainer.HandleIMGUIEvent(evt.imguiEvent)) { evt.StopPropagation(); evt.PreventDefault(); } } else { evt.target = panel.focusController.focusedElement; PropagateEvent(evt); } } else { evt.target = panel.visualTree; PropagateEvent(evt); if (!evt.isPropagationStopped) { PropagateToIMGUIContainer(panel.visualTree, evt); } } } else if (mouseEvent != null) { // FIXME: we should not change hover state when capture is true. // However, when doing drag and drop, drop target should be highlighted. // TODO when EditorWindow is docked MouseLeaveWindow is not always sent // this is a problem in itself but it could leave some elements as "hover" if (evt.GetEventTypeId() == MouseLeaveWindowEvent.TypeId()) { VisualElement currentTopElementUnderMouse = m_TopElementUnderMouse; m_TopElementUnderMouse = null; DispatchMouseEnterMouseLeave(currentTopElementUnderMouse, m_TopElementUnderMouse, mouseEvent); DispatchMouseOverMouseOut(currentTopElementUnderMouse, m_TopElementUnderMouse, mouseEvent); } else if (evt.GetEventTypeId() == DragExitedEvent.TypeId()) { VisualElement currentTopElementUnderMouse = m_TopElementUnderMouse; m_TopElementUnderMouse = null; DispatchDragEnterDragLeave(currentTopElementUnderMouse, m_TopElementUnderMouse, mouseEvent); } // update element under mouse and fire necessary events else { VisualElement currentTopElementUnderMouse = m_TopElementUnderMouse; if (evt.target == null && panel != null) { m_TopElementUnderMouse = panel.Pick(mouseEvent.mousePosition); evt.target = m_TopElementUnderMouse; } if (evt.target != null) { eventHandled = true; PropagateEvent(evt); } if (evt.GetEventTypeId() == MouseMoveEvent.TypeId() || evt.GetEventTypeId() == MouseDownEvent.TypeId() || evt.GetEventTypeId() == MouseUpEvent.TypeId() || evt.GetEventTypeId() == MouseEnterWindowEvent.TypeId() || evt.GetEventTypeId() == WheelEvent.TypeId()) { DispatchMouseEnterMouseLeave(currentTopElementUnderMouse, m_TopElementUnderMouse, mouseEvent); DispatchMouseOverMouseOut(currentTopElementUnderMouse, m_TopElementUnderMouse, mouseEvent); } else if (evt.GetEventTypeId() == DragUpdatedEvent.TypeId()) { DispatchDragEnterDragLeave(currentTopElementUnderMouse, m_TopElementUnderMouse, mouseEvent); } } } else if (panel != null && evt is ICommandEvent) { IMGUIContainer imguiContainer = panel.focusController.focusedElement as IMGUIContainer; eventHandled = true; if (imguiContainer != null) { if (imguiContainer != evt.skipElement && imguiContainer.HandleIMGUIEvent(evt.imguiEvent)) { evt.StopPropagation(); evt.PreventDefault(); } } else if (panel.focusController.focusedElement != null) { evt.target = panel.focusController.focusedElement; PropagateEvent(evt); } else { PropagateToIMGUIContainer(panel.visualTree, evt); } } else if (evt is IPropagatableEvent || evt is IFocusEvent || evt is IChangeEvent || evt.GetEventTypeId() == InputEvent.TypeId() || evt.GetEventTypeId() == GeometryChangedEvent.TypeId()) { Debug.Assert(evt.target != null); eventHandled = true; PropagateEvent(evt); } } if (!mouseEventWasCaptured && !evt.isPropagationStopped && panel != null) { Event e = evt.imguiEvent; if (!eventHandled || (e != null && e.type == EventType.Used) || evt.GetEventTypeId() == MouseEnterWindowEvent.TypeId() || evt.GetEventTypeId() == MouseLeaveWindowEvent.TypeId()) { PropagateToIMGUIContainer(panel.visualTree, evt); } } if (evt.target == null && panel != null) { evt.target = panel.visualTree; } ExecuteDefaultAction(evt); }
internal void CommitElementUnderPointers(EventDispatcher dispatcher) { for (var i = 0; i < m_TopElementUnderPointer.Length; i++) { var triggerPointerEvent = m_TriggerPointerEvent[i]; var previous = m_TopElementUnderPointer[i]; var current = m_PendingTopElementUnderPointer[i]; if (current == previous) { if (triggerPointerEvent != null) { var pos3d = triggerPointerEvent.position; m_PickingPointerPositions[i] = new Vector2(pos3d.x, pos3d.y); } else if (m_TriggerMouseEvent[i] != null) { m_PickingPointerPositions[i] = m_TriggerMouseEvent[i].mousePosition; } continue; } m_TopElementUnderPointer[i] = current; if (triggerPointerEvent == null && m_TriggerMouseEvent[i] == null) { using (new EventDispatcherGate(dispatcher)) { Vector2 position = PointerDeviceState.GetPointerPosition(i); PointerEventsHelper.SendOverOut(previous, current, null, position, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( previous, current, null, position, i); m_PickingPointerPositions[i] = position; if (i == PointerId.mousePointerId) { MouseEventsHelper.SendMouseOverMouseOut(previous, current, null, position); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( previous, current, null, position); } } } if (triggerPointerEvent != null) { var pos3d = triggerPointerEvent.position; m_PickingPointerPositions[i] = new Vector2(pos3d.x, pos3d.y); var baseEvent = triggerPointerEvent as EventBase; if (baseEvent != null && ( baseEvent.eventTypeId == PointerMoveEvent.TypeId() || baseEvent.eventTypeId == PointerDownEvent.TypeId() || baseEvent.eventTypeId == PointerUpEvent.TypeId() || baseEvent.eventTypeId == PointerCancelEvent.TypeId())) { using (new EventDispatcherGate(dispatcher)) { PointerEventsHelper.SendOverOut(previous, current, triggerPointerEvent, pos3d, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( previous, current, triggerPointerEvent, pos3d, i); } } } m_TriggerPointerEvent[i] = null; var triggerMouseEvent = m_TriggerMouseEvent[i]; if (triggerMouseEvent != null) { Vector2 mousePos = triggerMouseEvent.mousePosition; m_PickingPointerPositions[i] = mousePos; var baseEvent = triggerMouseEvent as EventBase; if (baseEvent != null) { if (baseEvent.eventTypeId == MouseMoveEvent.TypeId() || baseEvent.eventTypeId == MouseDownEvent.TypeId() || baseEvent.eventTypeId == MouseUpEvent.TypeId() || baseEvent.eventTypeId == WheelEvent.TypeId()) { using (new EventDispatcherGate(dispatcher)) { MouseEventsHelper.SendMouseOverMouseOut(previous, current, triggerMouseEvent, mousePos); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( previous, current, triggerMouseEvent, mousePos); } } else if (baseEvent.eventTypeId == MouseEnterWindowEvent.TypeId() || baseEvent.eventTypeId == MouseLeaveWindowEvent.TypeId() ) { using (new EventDispatcherGate(dispatcher)) { PointerEventsHelper.SendOverOut(previous, current, null, mousePos, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( previous, current, null, mousePos, i); if (i == PointerId.mousePointerId) { MouseEventsHelper.SendMouseOverMouseOut(previous, current, triggerMouseEvent, mousePos); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( previous, current, triggerMouseEvent, mousePos); } } } else if (baseEvent.eventTypeId == DragUpdatedEvent.TypeId() || baseEvent.eventTypeId == DragExitedEvent.TypeId()) { using (new EventDispatcherGate(dispatcher)) { PointerEventsHelper.SendOverOut(previous, current, null, mousePos, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( previous, current, null, mousePos, i); MouseEventsHelper.SendMouseOverMouseOut(previous, current, triggerMouseEvent, mousePos); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( previous, current, triggerMouseEvent, mousePos); MouseEventsHelper.SendEnterLeave <DragLeaveEvent, DragEnterEvent>( previous, current, triggerMouseEvent, mousePos); } } } m_TriggerMouseEvent[i] = null; } } }
internal void CommitElementUnderPointers(EventDispatcher dispatcher) { for (var i = 0; i < m_TopElementUnderPointer.Length; i++) { if (m_TopElementUnderPointer[i] == m_PendingTopElementUnderPointer[i]) { continue; } if (m_TriggerPointerEvent[i] == null && m_TriggerMouseEvent[i] == null) { using (new EventDispatcherGate(dispatcher)) { Vector2 position = PointerDeviceState.GetPointerPosition(i); PointerEventsHelper.SendOverOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, position, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, position, i); if (i == PointerId.mousePointerId) { MouseEventsHelper.SendMouseOverMouseOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, position); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, position); } } } if (m_TriggerPointerEvent[i] != null) { if ((m_TriggerPointerEvent[i] as EventBase)?.eventTypeId == PointerMoveEvent.TypeId() || (m_TriggerPointerEvent[i] as EventBase)?.eventTypeId == PointerDownEvent.TypeId() || (m_TriggerPointerEvent[i] as EventBase)?.eventTypeId == PointerUpEvent.TypeId() || (m_TriggerPointerEvent[i] as EventBase)?.eventTypeId == PointerCancelEvent.TypeId()) { using (new EventDispatcherGate(dispatcher)) { PointerEventsHelper.SendOverOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerPointerEvent[i], m_TriggerPointerEvent[i].position, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerPointerEvent[i], m_TriggerPointerEvent[i].position, i); } } m_TriggerPointerEvent[i] = null; } if (m_TriggerMouseEvent[i] != null) { if ((m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == MouseMoveEvent.TypeId() || (m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == MouseDownEvent.TypeId() || (m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == MouseUpEvent.TypeId() || (m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == WheelEvent.TypeId()) { using (new EventDispatcherGate(dispatcher)) { MouseEventsHelper.SendMouseOverMouseOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); } } else if ((m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == MouseEnterWindowEvent.TypeId() || (m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == MouseLeaveWindowEvent.TypeId() ) { using (new EventDispatcherGate(dispatcher)) { PointerEventsHelper.SendOverOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, m_TriggerMouseEvent[i].mousePosition, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, m_TriggerMouseEvent[i].mousePosition, i); if (i == PointerId.mousePointerId) { MouseEventsHelper.SendMouseOverMouseOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); } } } else if ((m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == DragUpdatedEvent.TypeId() || (m_TriggerMouseEvent[i] as EventBase)?.eventTypeId == DragExitedEvent.TypeId()) { using (new EventDispatcherGate(dispatcher)) { PointerEventsHelper.SendOverOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, m_TriggerMouseEvent[i].mousePosition, i); PointerEventsHelper.SendEnterLeave <PointerLeaveEvent, PointerEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], null, m_TriggerMouseEvent[i].mousePosition, i); MouseEventsHelper.SendMouseOverMouseOut(m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); MouseEventsHelper.SendEnterLeave <MouseLeaveEvent, MouseEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); MouseEventsHelper.SendEnterLeave <DragLeaveEvent, DragEnterEvent>( m_TopElementUnderPointer[i], m_PendingTopElementUnderPointer[i], m_TriggerMouseEvent[i], m_TriggerMouseEvent[i].mousePosition); } } m_TriggerMouseEvent[i] = null; } m_TopElementUnderPointer[i] = m_PendingTopElementUnderPointer[i]; } }
void UpdateEventbaseInfo(EventDebuggerEventRecord eventBase, IEventHandler focused, IEventHandler capture) { ClearEventbaseInfo(); if (eventBase == null) { return; } m_EventbaseInfo.text += "Focused element: " + EventDebugger.GetObjectDisplayName(focused) + "\n"; m_EventbaseInfo.text += "Capture element: " + EventDebugger.GetObjectDisplayName(capture) + "\n"; if (eventBase.eventTypeId == MouseMoveEvent.TypeId() || eventBase.eventTypeId == MouseOverEvent.TypeId() || eventBase.eventTypeId == MouseOutEvent.TypeId() || eventBase.eventTypeId == MouseDownEvent.TypeId() || eventBase.eventTypeId == MouseUpEvent.TypeId() || eventBase.eventTypeId == MouseEnterEvent.TypeId() || eventBase.eventTypeId == MouseLeaveEvent.TypeId() || eventBase.eventTypeId == DragEnterEvent.TypeId() || eventBase.eventTypeId == DragLeaveEvent.TypeId() || eventBase.eventTypeId == DragUpdatedEvent.TypeId() || eventBase.eventTypeId == DragPerformEvent.TypeId() || eventBase.eventTypeId == DragExitedEvent.TypeId() || eventBase.eventTypeId == ContextClickEvent.TypeId() || eventBase.eventTypeId == PointerMoveEvent.TypeId() || eventBase.eventTypeId == PointerOverEvent.TypeId() || eventBase.eventTypeId == PointerOutEvent.TypeId() || eventBase.eventTypeId == PointerDownEvent.TypeId() || eventBase.eventTypeId == PointerUpEvent.TypeId() || eventBase.eventTypeId == PointerCancelEvent.TypeId() || eventBase.eventTypeId == PointerStationaryEvent.TypeId() || eventBase.eventTypeId == PointerEnterEvent.TypeId() || eventBase.eventTypeId == PointerLeaveEvent.TypeId()) { m_EventbaseInfo.text += "Mouse position: " + eventBase.mousePosition + "\n"; m_EventbaseInfo.text += "Modifiers: " + eventBase.modifiers + "\n"; } if (eventBase.eventTypeId == KeyDownEvent.TypeId() || eventBase.eventTypeId == KeyUpEvent.TypeId()) { m_EventbaseInfo.text += "Modifiers: " + eventBase.modifiers + "\n"; } if (eventBase.eventTypeId == MouseDownEvent.TypeId() || eventBase.eventTypeId == MouseUpEvent.TypeId() || eventBase.eventTypeId == PointerDownEvent.TypeId() || eventBase.eventTypeId == PointerUpEvent.TypeId() || eventBase.eventTypeId == DragUpdatedEvent.TypeId() || eventBase.eventTypeId == DragPerformEvent.TypeId() || eventBase.eventTypeId == DragExitedEvent.TypeId()) { m_EventbaseInfo.text += "Button: " + (eventBase.button == 0 ? "Left" : eventBase.button == 1 ? "Middle" : "Right") + "\n"; m_EventbaseInfo.text += "Click count: " + eventBase.clickCount + "\n"; } if (eventBase.eventTypeId == MouseMoveEvent.TypeId() || eventBase.eventTypeId == MouseOverEvent.TypeId() || eventBase.eventTypeId == MouseOutEvent.TypeId() || eventBase.eventTypeId == MouseDownEvent.TypeId() || eventBase.eventTypeId == MouseUpEvent.TypeId() || eventBase.eventTypeId == MouseEnterEvent.TypeId() || eventBase.eventTypeId == MouseLeaveEvent.TypeId() || eventBase.eventTypeId == DragEnterEvent.TypeId() || eventBase.eventTypeId == DragLeaveEvent.TypeId() || eventBase.eventTypeId == DragUpdatedEvent.TypeId() || eventBase.eventTypeId == DragPerformEvent.TypeId() || eventBase.eventTypeId == DragExitedEvent.TypeId() || eventBase.eventTypeId == ContextClickEvent.TypeId() || eventBase.eventTypeId == WheelEvent.TypeId() || eventBase.eventTypeId == PointerMoveEvent.TypeId() || eventBase.eventTypeId == PointerOverEvent.TypeId() || eventBase.eventTypeId == PointerOutEvent.TypeId() || eventBase.eventTypeId == PointerDownEvent.TypeId() || eventBase.eventTypeId == PointerUpEvent.TypeId() || eventBase.eventTypeId == PointerCancelEvent.TypeId() || eventBase.eventTypeId == PointerStationaryEvent.TypeId() || eventBase.eventTypeId == PointerEnterEvent.TypeId() || eventBase.eventTypeId == PointerLeaveEvent.TypeId()) { m_EventbaseInfo.text += "Pressed buttons: " + eventBase.pressedButtons + "\n"; } if (eventBase.eventTypeId == WheelEvent.TypeId()) { m_EventbaseInfo.text += "Mouse delta: " + eventBase.delta + "\n"; } if (eventBase.eventTypeId == KeyDownEvent.TypeId() || eventBase.eventTypeId == KeyUpEvent.TypeId()) { if (char.IsControl(eventBase.character)) { m_EventbaseInfo.text += "Character: \\" + (byte)(eventBase.character) + "\n"; } else { m_EventbaseInfo.text += "Character: " + eventBase.character + "\n"; } m_EventbaseInfo.text += "Key code: " + eventBase.keyCode + "\n"; } if (eventBase.eventTypeId == ValidateCommandEvent.TypeId() || eventBase.eventTypeId == ExecuteCommandEvent.TypeId()) { m_EventbaseInfo.text += "Command: " + eventBase.commandName + "\n"; } }