private static bool SendEventToIMGUIContainer(EventBase evt, BaseVisualElementPanel panel) { bool flag = evt.imguiEvent == null; bool result; if (flag) { result = false; } else { IMGUIContainer rootIMGUIContainer = panel.rootIMGUIContainer; bool flag2 = rootIMGUIContainer == null; if (flag2) { result = false; } else { bool flag3 = evt.propagateToIMGUI || evt.eventTypeId == EventBase <MouseEnterWindowEvent> .TypeId() || evt.eventTypeId == EventBase <MouseLeaveWindowEvent> .TypeId(); if (flag3) { evt.skipElements.Add(evt.target); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } result = MouseEventDispatchingStrategy.IsDone(evt); } } return(result); }
static bool SendEventToIMGUIContainer(EventBase evt, BaseVisualElementPanel panel) { if (evt.imguiEvent == null) { return(false); } // Root IMGUI is the container that handles all the GUIView/DockArea logic for EditorWindows. var rootIMGUI = panel.rootIMGUIContainer; if (rootIMGUI == null) { return(false); } // If root IMGUI doesn't use event, send it to other IMGUIs down the line. if (evt.propagateToIMGUI || evt.eventTypeId == DragExitedEvent.TypeId() || evt.eventTypeId == MouseEnterWindowEvent.TypeId() || evt.eventTypeId == MouseLeaveWindowEvent.TypeId()) { evt.skipElements.Add(evt.target); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } return(IsDone(evt)); }
public void DispatchEvent(EventBase evt, IPanel panel) { bool flag = panel != null; if (flag) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } evt.propagateToIMGUI = false; evt.stopDispatch = true; }
public void DispatchEvent(EventBase evt, IPanel panel) { bool flag = panel != null; if (flag) { Focusable leafFocusedElement = panel.focusController.GetLeafFocusedElement(); bool flag2 = leafFocusedElement != null; if (flag2) { bool isIMGUIContainer = leafFocusedElement.isIMGUIContainer; if (isIMGUIContainer) { IMGUIContainer iMGUIContainer = (IMGUIContainer)leafFocusedElement; bool flag3 = !evt.Skip(iMGUIContainer) && iMGUIContainer.SendEventToIMGUI(evt, true, true); if (flag3) { evt.StopPropagation(); evt.PreventDefault(); } bool flag4 = !evt.isPropagationStopped && evt.propagateToIMGUI; if (flag4) { evt.skipElements.Add(iMGUIContainer); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } else { evt.target = panel.focusController.GetLeafFocusedElement(); EventDispatchUtilities.PropagateEvent(evt); bool flag5 = !evt.isPropagationStopped && evt.propagateToIMGUI; if (flag5) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } } else { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } evt.propagateToIMGUI = false; evt.stopDispatch = true; }
internal static void PropagateToIMGUIContainer(VisualElement root, EventBase evt) { bool flag = evt.imguiEvent == null || root.elementPanel.contextType == ContextType.Player; if (!flag) { bool isIMGUIContainer = root.isIMGUIContainer; if (isIMGUIContainer) { IMGUIContainer iMGUIContainer = root as IMGUIContainer; bool flag2 = evt.Skip(iMGUIContainer); if (flag2) { return; } Focusable expr_54 = evt.target as Focusable; bool flag3 = expr_54 != null && expr_54.focusable; bool flag4 = iMGUIContainer.SendEventToIMGUI(evt, !flag3, true); if (flag4) { evt.StopPropagation(); evt.PreventDefault(); } bool flag5 = evt.imguiEvent.rawType == EventType.Used; if (flag5) { Debug.Assert(evt.isPropagationStopped); } } bool flag6 = root.imguiContainerDescendantCount > 0; if (flag6) { int childCount = root.hierarchy.childCount; for (int i = 0; i < childCount; i++) { EventDispatchUtilities.PropagateToIMGUIContainer(root.hierarchy[i], evt); bool isPropagationStopped = evt.isPropagationStopped; if (isPropagationStopped) { break; } } } } }
static bool SendEventToIMGUIContainer(EventBase evt, BaseVisualElementPanel panel) { if (evt.imguiEvent == null) { return(false); } // Root IMGUI is the container that handles all the GUIView/DockArea logic for EditorWindows. var rootIMGUI = panel.rootIMGUIContainer; if (rootIMGUI == null) { return(false); } // If root IMGUI doesn't use event, send it to other IMGUIs down the line. if (evt.propagateToIMGUI || evt.eventTypeId == MouseEnterWindowEvent.TypeId() || evt.eventTypeId == MouseLeaveWindowEvent.TypeId() || evt.target == rootIMGUI ) { evt.skipElements.Add(evt.target); EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } // If non-root element doesn't use event, send it to root IMGUI. // This is necessary for some behaviors like dropdown menus in IMGUI. // See case : https://fogbugz.unity3d.com/f/cases/1223087/ else { evt.skipElements.Add(evt.target); if (!evt.Skip(rootIMGUI)) { // Only permit switching the focus to another IMGUIContainer if the event target was not focusable // and was itself an IMGUIContainer bool canAffectFocus = evt.target is Focusable f && !f.focusable && f.isIMGUIContainer; rootIMGUI.SendEventToIMGUI(evt, canAffectFocus); } } return(IsDone(evt)); }
static bool SendEventToIMGUIContainer(EventBase evt, BaseVisualElementPanel panel) { if (evt.propagateToIMGUI || evt.eventTypeId == MouseEnterWindowEvent.TypeId() || evt.eventTypeId == MouseLeaveWindowEvent.TypeId() ) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } else { // Send the events to the GUIView container so that it can process them. // This is necessary for some behaviors like dropdown menus in IMGUI. // See case : https://fogbugz.unity3d.com/f/cases/1223087/ var topLevelIMGUI = panel.rootIMGUIContainer; if (topLevelIMGUI != null && !evt.Skip(topLevelIMGUI) && evt.imguiEvent != null) { topLevelIMGUI.SendEventToIMGUI(evt, false); } } return(IsDone(evt)); }
public void DispatchEvent(EventBase evt, IPanel panel) { bool flag = evt.target != null; if (flag) { evt.propagateToIMGUI = (evt.target is IMGUIContainer); EventDispatchUtilities.PropagateEvent(evt); } else { bool flag2 = !evt.isPropagationStopped && panel != null; if (flag2) { bool flag3 = evt.propagateToIMGUI || evt.eventTypeId == EventBase <MouseEnterWindowEvent> .TypeId() || evt.eventTypeId == EventBase <MouseLeaveWindowEvent> .TypeId(); if (flag3) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } } evt.stopDispatch = true; }
public virtual void DispatchEvent(EventBase evt, IPanel panel) { IMouseEvent mouseEvent = evt as IMouseEvent; // 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" BaseVisualElementPanel basePanel = panel as BaseVisualElementPanel; if (basePanel != null && (evt.eventTypeId == MouseLeaveWindowEvent.TypeId() || evt.eventTypeId == DragExitedEvent.TypeId())) { basePanel.SetElementUnderMouse(null, evt); } else { // update element under mouse and fire necessary events if (basePanel != null) { bool shouldRecomputeTopElementUnderMouse = true; if ((IMouseEventInternal)mouseEvent != null) { shouldRecomputeTopElementUnderMouse = ((IMouseEventInternal)mouseEvent).recomputeTopElementUnderMouse; } VisualElement elementUnderMouse = shouldRecomputeTopElementUnderMouse ? basePanel.Pick(mouseEvent.mousePosition) : basePanel.topElementUnderMouse; if (evt.target == null) { evt.target = elementUnderMouse; } // Because events are queued, we can set the element under mouse // right now, instead of waiting after the PropagateEvent() as we // did before. basePanel.SetElementUnderMouse(elementUnderMouse, evt); } if (evt.target != null) { evt.propagateToIMGUI = false; EventDispatchUtilities.PropagateEvent(evt); } } if (!evt.isPropagationStopped && panel != null) { if (evt.propagateToIMGUI || evt.eventTypeId == MouseEnterWindowEvent.TypeId() || evt.eventTypeId == MouseLeaveWindowEvent.TypeId() ) { EventDispatchUtilities.PropagateToIMGUIContainer(panel.visualTree, evt); } } evt.stopDispatch = true; }