Example #1
0
        protected virtual IEnumerable <Gesture> EnumerateGestures(Node node)
        {
            var noMoreClicks       = new bool[3];
            var noMoreDoubleClicks = new bool[3];

            for (; node != null; node = node.Parent)
            {
                if (node.HasGestures())
                {
                    foreach (var g in node.Gestures)
                    {
                        if (g is ClickGesture cg)
                        {
                            if (noMoreClicks[cg.ButtonIndex])
                            {
                                continue;
                            }
                            noMoreClicks[cg.ButtonIndex] = true;
                        }
                        if (g is DoubleClickGesture dcg)
                        {
                            if (noMoreDoubleClicks[dcg.ButtonIndex])
                            {
                                continue;
                            }
                            noMoreDoubleClicks[dcg.ButtonIndex] = true;
                        }
                        yield return(g);
                    }
                }
            }
        }
Example #2
0
 protected virtual IEnumerable <Gesture> EnumerateGestures(Node node)
 {
     for (bool noClickGesturesAnymore = false; node != null; node = node.Parent)
     {
         if (!node.HasGestures())
         {
             continue;
         }
         bool anyClickGesture = false;
         foreach (var gesture in node.Gestures)
         {
             bool isWrongGesture = gesture is ClickGesture || gesture is DoubleClickGesture;
             if (isWrongGesture && noClickGesturesAnymore)
             {
                 continue;
             }
             anyClickGesture |= isWrongGesture;
             yield return(gesture);
         }
         noClickGesturesAnymore |= anyClickGesture;
     }
 }
Example #3
0
        protected virtual IEnumerable <Gesture> EnumerateGestures(Node node)
        {
            var noClickGesturesAnymore = false;

            while (node != null)
            {
                if (node.HasGestures())
                {
                    var anyClickGesture = false;
                    foreach (var r in node.Gestures)
                    {
                        bool isWrongGesture = r is ClickGesture || r is DoubleClickGesture;
                        if (isWrongGesture && noClickGesturesAnymore)
                        {
                            continue;
                        }
                        anyClickGesture |= isWrongGesture;
                        yield return(r);
                    }
                    noClickGesturesAnymore |= anyClickGesture;
                }
                node = node.Parent;
            }
        }