Exemple #1
0
        private EventPropagation PropagateEvent(VisualElement target, Event evt)
        {
            List <VisualElement> list      = this.BuildPropagationPath(target);
            Vector2          mousePosition = evt.mousePosition;
            EventPropagation result;

            for (int i = 0; i < list.Count; i++)
            {
                VisualElement visualElement = list[i];
                if (visualElement.enabled)
                {
                    evt.mousePosition = visualElement.GlobalToBound(mousePosition);
                    List <IManipulator> .Enumerator manipulatorsInternal = visualElement.GetManipulatorsInternal();
                    while (manipulatorsInternal.MoveNext())
                    {
                        IManipulator current = manipulatorsInternal.Current;
                        if (current.phaseInterest == EventPhase.Capture && current.HandleEvent(evt, target) == EventPropagation.Stop)
                        {
                            result = EventPropagation.Stop;
                            return(result);
                        }
                    }
                    if (visualElement.phaseInterest != EventPhase.Capture || visualElement.HandleEvent(evt, target) != EventPropagation.Stop)
                    {
                        goto IL_A2;
                    }
                    result = EventPropagation.Stop;
                    return(result);
                }
                IL_A2 :;
            }
            if (target.enabled)
            {
                evt.mousePosition = target.GlobalToBound(mousePosition);
                List <IManipulator> .Enumerator manipulatorsInternal2 = target.GetManipulatorsInternal();
                while (manipulatorsInternal2.MoveNext())
                {
                    IManipulator current2 = manipulatorsInternal2.Current;
                    if (current2.phaseInterest == EventPhase.Capture && current2.HandleEvent(evt, target) == EventPropagation.Stop)
                    {
                        result = EventPropagation.Stop;
                        return(result);
                    }
                }
                if (target.HandleEvent(evt, target) == EventPropagation.Stop)
                {
                    result = EventPropagation.Stop;
                    return(result);
                }
                manipulatorsInternal2 = target.GetManipulatorsInternal();
                while (manipulatorsInternal2.MoveNext())
                {
                    IManipulator current3 = manipulatorsInternal2.Current;
                    if (current3.phaseInterest == EventPhase.BubbleUp && current3.HandleEvent(evt, target) == EventPropagation.Stop)
                    {
                        result = EventPropagation.Stop;
                        return(result);
                    }
                }
            }
            for (int j = list.Count - 1; j >= 0; j--)
            {
                VisualElement visualElement2 = list[j];
                if (visualElement2.enabled)
                {
                    evt.mousePosition = visualElement2.GlobalToBound(mousePosition);
                    if (visualElement2.phaseInterest == EventPhase.BubbleUp && visualElement2.HandleEvent(evt, target) == EventPropagation.Stop)
                    {
                        result = EventPropagation.Stop;
                        return(result);
                    }
                    List <IManipulator> .Enumerator manipulatorsInternal3 = visualElement2.GetManipulatorsInternal();
                    while (manipulatorsInternal3.MoveNext())
                    {
                        IManipulator current4 = manipulatorsInternal3.Current;
                        if (current4.phaseInterest == EventPhase.BubbleUp && current4.HandleEvent(evt, target) == EventPropagation.Stop)
                        {
                            result = EventPropagation.Stop;
                            return(result);
                        }
                    }
                }
            }
            result = EventPropagation.Continue;
            return(result);
        }