public virtual void HandleEvent(EventBase evt) { // This is only useful because HandleEvent is public and can be called from user code. if (evt == null) { return; } switch (evt.propagationPhase) { case PropagationPhase.TrickleDown: case PropagationPhase.BubbleUp: { if (!evt.isPropagationStopped) { m_CallbackRegistry?.InvokeCallbacks(evt, evt.propagationPhase); } if (isIMGUIContainer && !evt.isPropagationStopped) { ((IMGUIContainer)this).ProcessEvent(evt); } break; } case PropagationPhase.AtTarget: { //We make sure we invoke callbacks from the TrickleDownPhase before the BubbleUp ones when we are directly at target if (!evt.isPropagationStopped) { m_CallbackRegistry?.InvokeCallbacks(evt, PropagationPhase.TrickleDown); } if (!evt.isPropagationStopped) { m_CallbackRegistry?.InvokeCallbacks(evt, PropagationPhase.BubbleUp); } if (isIMGUIContainer && !evt.isPropagationStopped) { ((IMGUIContainer)this).ProcessEvent(evt); } } break; case PropagationPhase.DefaultActionAtTarget: { if (!evt.isDefaultPrevented) { using (new EventDebuggerLogExecuteDefaultAction(evt)) { if (evt.skipDisabledElements && this is VisualElement ve && !ve.enabledInHierarchy) { ExecuteDefaultActionDisabledAtTarget(evt); } else { ExecuteDefaultActionAtTarget(evt); } } } break; }
public virtual void HandleEvent(EventBase evt) { bool flag = evt == null; if (!flag) { switch (evt.propagationPhase) { case PropagationPhase.TrickleDown: case PropagationPhase.AtTarget: case PropagationPhase.BubbleUp: { bool flag2 = !evt.isPropagationStopped; if (flag2) { EventCallbackRegistry expr_4D = this.m_CallbackRegistry; if (expr_4D != null) { expr_4D.InvokeCallbacks(evt); } } break; } case PropagationPhase.DefaultAction: { bool flag3 = !evt.isDefaultPrevented; if (flag3) { using (new EventDebuggerLogExecuteDefaultAction(evt)) { this.ExecuteDefaultAction(evt); } } break; } case PropagationPhase.DefaultActionAtTarget: { bool flag4 = !evt.isDefaultPrevented; if (flag4) { using (new EventDebuggerLogExecuteDefaultAction(evt)) { this.ExecuteDefaultActionAtTarget(evt); } } break; } } } }
public virtual void HandleEvent(EventBase evt) { if (evt == null) { return; } if (evt.propagationPhase != PropagationPhase.DefaultAction) { if (!evt.isPropagationStopped) { m_CallbackRegistry?.InvokeCallbacks(evt); } if (evt.propagationPhase == PropagationPhase.AtTarget && !evt.isDefaultPrevented) { ExecuteDefaultActionAtTarget(evt); } } else if (!evt.isDefaultPrevented) { ExecuteDefaultAction(evt); } }