void AddExecuteDefaultAction(EventBase evt, PropagationPhase phase, long duration, IEventHandler mouseCapture) { if (m_Log) { var defaultActionObject = new EventDebuggerDefaultActionTrace(panel, evt, phase, duration, mouseCapture); List <EventDebuggerDefaultActionTrace> list; if (m_EventDefaultActionObjects.ContainsKey(panel)) { list = m_EventDefaultActionObjects[panel]; } else { list = new List <EventDebuggerDefaultActionTrace>(); m_EventDefaultActionObjects.Add(panel, list); } list.Add(defaultActionObject); } }
public override void Invoke(EventBase evt, PropagationPhase propagationPhase) { if (evt == null) { throw new ArgumentNullException(nameof(evt)); } if (evt.eventTypeId != m_EventTypeId) { return; } if (PhaseMatches(propagationPhase)) { using (new EventDebuggerLogCall(m_Callback, evt)) { m_Callback(evt as TEventType); } } }
void AddExecuteDefaultAction(EventBase evt, PropagationPhase phase, long duration, IEventHandler mouseCapture) { if (suspended) { return; } if (m_Log) { var defaultActionObject = new EventDebuggerDefaultActionTrace(panel, evt, phase, duration, mouseCapture); if (!m_EventDefaultActionObjects.TryGetValue(panel, out var list)) { list = new List <EventDebuggerDefaultActionTrace>(); m_EventDefaultActionObjects.Add(panel, list); } list.Add(defaultActionObject); } }
public void InvokeCallbacks(EventBase evt, PropagationPhase propagationPhase) { if (m_Callbacks == null) { return; } m_IsInvoking++; var currentTarget = (VisualElement)evt.currentTarget; var panel = currentTarget.panel; for (var i = 0; i < m_Callbacks.Count; i++) { if (evt.isImmediatePropagationStopped || currentTarget.panel != panel) { break; } if (evt.skipDisabledElements && !currentTarget.enabledInHierarchy && m_Callbacks[i].invokePolicy != InvokePolicy.IncludeDisabled) { continue; } m_Callbacks[i].Invoke(evt, propagationPhase); } m_IsInvoking--; if (m_IsInvoking == 0) { // If callbacks were modified during callback invocation, update them now. if (m_TemporaryCallbacks != null) { ReleaseCallbackList(m_Callbacks); m_Callbacks = GetCallbackList(m_TemporaryCallbacks); ReleaseCallbackList(m_TemporaryCallbacks); m_TemporaryCallbacks = null; } } }
protected bool PhaseMatches(PropagationPhase propagationPhase) { switch (phase) { case CallbackPhase.TrickleDownAndTarget: if (propagationPhase != PropagationPhase.TrickleDown && propagationPhase != PropagationPhase.AtTarget) { return(false); } break; case CallbackPhase.TargetAndBubbleUp: if (propagationPhase != PropagationPhase.AtTarget && propagationPhase != PropagationPhase.BubbleUp) { return(false); } break; } return(true); }
private void AddExecuteDefaultAction(EventBase evt, PropagationPhase phase, long duration, IEventHandler mouseCapture) { bool log = this.m_Log; if (log) { EventDebuggerDefaultActionTrace item = new EventDebuggerDefaultActionTrace(this.panel, evt, phase, duration, mouseCapture); bool flag = this.m_EventDefaultActionObjects.ContainsKey(this.panel); List <EventDebuggerDefaultActionTrace> list; if (flag) { list = this.m_EventDefaultActionObjects[this.panel]; } else { list = new List <EventDebuggerDefaultActionTrace>(); this.m_EventDefaultActionObjects.Add(this.panel, list); } list.Add(item); } }
public void LogExecuteDefaultAction(EventBase evt, PropagationPhase phase, long duration, IEventHandler mouseCapture) { AddExecuteDefaultAction(evt, phase, duration, mouseCapture); UpdateModificationCount(); }
public EventDebuggerDefaultActionTrace(IPanel panel, EventBase evt, PropagationPhase phase, long duration, IEventHandler mouseCapture) : base(panel, evt, duration, mouseCapture) { this.< phase > k__BackingField = phase; }
public abstract void Invoke(EventBase evt, PropagationPhase propagationPhase);