static void ForEachOnlyEventPortalBubbleUp <T>(T e, HitChain hitPointChain, EventPortalAction <T> eventPortalAction)
     where T : UIEventArgs
 {
     for (int i = hitPointChain.Count - 1; i >= 0; --i)
     {
         HitInfo hitPoint      = hitPointChain.GetHitInfo(i);
         object  currentHitObj = hitPoint.HitElemAsRenderElement.GetController();
         if (currentHitObj is IEventPortal eventPortal)
         {
             Point p = hitPoint.point;
             e.SetCurrentContextElement(currentHitObj as IUIEventListener);
             e.SetLocation(p.X, p.Y);
             if (eventPortalAction(e, 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 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;
                    }
                }
            }
        }
Exemple #4
0
 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 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 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;
                    }
                }
            }
        }