static void ForEachEventListenerBubbleUp(UIEventArgs e, HitChain hitPointChain, EventListenerAction listenerAction) { HitInfo hitInfo; for (int i = hitPointChain.Count - 1; i >= 0; --i) { hitInfo = hitPointChain.GetHitInfo(i); IUIEventListener listener = hitInfo.hitElement.GetController() as IUIEventListener; if (listener != null) { if (e.SourceHitElement == null) { e.SourceHitElement = listener; } var hitPoint = hitInfo.point; e.SetLocation(hitPoint.X, hitPoint.Y); e.CurrentContextElement = listener; if (listenerAction(listener)) { return; } } } }
static void ForEachOnlyEventPortalBubbleUp(UIEventArgs e, HitChain hitPointChain, EventPortalAction eventPortalAction) { for (int i = hitPointChain.Count - 1; i >= 0; --i) { HitInfo hitPoint = hitPointChain.GetHitInfo(i); object currentHitElement = hitPoint.hitElement.GetController(); IEventPortal eventPortal = currentHitElement as IEventPortal; if (eventPortal != null) { var ppp = hitPoint.point; e.CurrentContextElement = currentHitElement as IUIEventListener; e.SetLocation(ppp.X, ppp.Y); if (eventPortalAction(eventPortal)) { return; } } } }
static void ForEachOnlyEventPortalBubbleUp(UIEventArgs e, SvgHitChain hitPointChain, EventPortalAction eventPortalAction) { //only listener that need tunnel down for (int i = hitPointChain.Count - 1; i >= 0; --i) { //propagate up var hitInfo = hitPointChain.GetHitInfo(i); SvgElement svg = hitInfo.svg; if (svg != null) { var controller = SvgElement.UnsafeGetController(hitInfo.svg) as IEventPortal; if (controller != null) { e.SetLocation((int)hitInfo.x, (int)hitInfo.y); if (eventPortalAction(controller)) { return; } } } } }
static void ForEachEventListenerBubbleUp(UIEventArgs e, HitChain hitPointChain, EventListenerAction listenerAction) { HitInfo hitInfo; for (int i = hitPointChain.Count - 1; i >= 0; --i) { hitInfo = hitPointChain.GetHitInfo(i); IEventListener listener = hitInfo.hitElement.GetController() as IEventListener; if (listener != null) { if (e.SourceHitElement == null) { e.SourceHitElement = listener; } var hitPoint = hitInfo.point; e.SetLocation(hitPoint.X, hitPoint.Y); e.CurrentContextElement = listener; if (listenerAction(listener)) { return; } } } }
static void ForEachOnlyEventPortalBubbleUp(UIEventArgs e, HitChain hitPointChain, EventPortalAction eventPortalAction) { for (int i = hitPointChain.Count - 1; i >= 0; --i) { HitInfo hitPoint = hitPointChain.GetHitInfo(i); object currentHitElement = hitPoint.hitElement.GetController(); IEventPortal eventPortal = currentHitElement as IEventPortal; if (eventPortal != null) { var ppp = hitPoint.point; e.CurrentContextElement = currentHitElement as IEventListener; e.SetLocation(ppp.X, ppp.Y); if (eventPortalAction(eventPortal)) { return; } } } }
static void ForEachEventListenerBubbleUp(UIEventArgs e, SvgHitChain hitChain, EventListenerAction listenerAction) { for (int i = hitChain.Count - 1; i >= 0; --i) { //propagate up var hitInfo = hitChain.GetHitInfo(i); IEventListener controller = SvgElement.UnsafeGetController(hitInfo.svg) as IEventListener; //switch (hitInfo.hitObjectKind) //{ // default: // { // continue; // } // case HitObjectKind.Run: // { // CssRun run = (CssRun)hitInfo.hitObject; // controller = CssBox.UnsafeGetController(run.OwnerBox) as IEventListener; // } break; // case HitObjectKind.CssBox: // { // CssBox box = (CssBox)hitInfo.hitObject; // controller = CssBox.UnsafeGetController(box) as IEventListener; // } break; //} //--------------------- if (controller != null) { //found controller e.CurrentContextElement = controller; e.SetLocation((int)hitInfo.x, (int)hitInfo.y); if (listenerAction()) { return; } } } }
static void ForEachSvgElementBubbleUp(UIEventArgs e, SvgHitChain hitChain, EventListenerAction listenerAction) { for (int i = hitChain.Count - 1; i >= 0; --i) { //propagate up var hitInfo = hitChain.GetHitInfo(i); //--------------------- //hit on element e.SetLocation((int)hitInfo.x, (int)hitInfo.y); if (listenerAction()) { return; } } }
static void ForEachEventListenerBubbleUp(UIEventArgs e, CssBoxHitChain hitChain, EventListenerAction listenerAction) { for (int i = hitChain.Count - 1; i >= 0; --i) { //propagate up var hitInfo = hitChain.GetHitInfo(i); IEventListener controller = null; switch (hitInfo.hitObjectKind) { default: { continue; } case HitObjectKind.Run: { CssRun run = (CssRun)hitInfo.hitObject; controller = CssBox.UnsafeGetController(run.OwnerBox) as IEventListener; } break; case HitObjectKind.CssBox: { CssBox box = (CssBox)hitInfo.hitObject; controller = CssBox.UnsafeGetController(box) as IEventListener; } break; } //--------------------- if (controller != null) { //found controller if (e.SourceHitElement == null) { e.SourceHitElement = controller; } e.CurrentContextElement = controller; e.SetLocation(hitInfo.localX, hitInfo.localY); if (listenerAction()) { return; } } } }
static void ForEachOnlyEventPortalBubbleUp(UIEventArgs e, CssBoxHitChain hitPointChain, EventPortalAction eventPortalAction) { //only listener that need tunnel down for (int i = hitPointChain.Count - 1; i >= 0; --i) { //propagate up var hitInfo = hitPointChain.GetHitInfo(i); IEventPortal controller = null; switch (hitInfo.hitObjectKind) { default: { continue; } case HitObjectKind.Run: { CssRun run = (CssRun)hitInfo.hitObject; controller = CssBox.UnsafeGetController(run.OwnerBox) as IEventPortal; } break; case HitObjectKind.CssBox: { CssBox box = (CssBox)hitInfo.hitObject; controller = CssBox.UnsafeGetController(box) as IEventPortal; } break; } //--------------------- if (controller != null) { e.SetLocation(hitInfo.localX, hitInfo.localY); if (eventPortalAction(controller)) { return; } } } }