Ejemplo n.º 1
0
 private bool ConsumeDrags(GestureSamples gestureSamples)
 {
     bool dragsConsumed = false;
     List<GestureSample> freeDrags = gestureSamples.GetSamples (GestureType.FreeDrag);
     foreach (GestureSample freeDrag in freeDrags) {
         if (IsGestureWithinView (freeDrag)) {
             Position += freeDrag.Delta;
             dragsConsumed = true;
         }
     }
     return dragsConsumed;
 }
Ejemplo n.º 2
0
        private bool ConsumePinches(GestureSamples gestureSamples)
        {
            Vector2 initialPosition = Position;
            bool pinchesConsumed = false;
            List<GestureSample> pinches = gestureSamples.GetSamples (GestureType.Pinch);
            foreach (GestureSample pinch in pinches) {
                if (IsGestureWithinView (pinch)) {
                    float scaleFactor = GetPinchScaleFactor (pinch);
                    Scale *= scaleFactor;
                    Position = GetPinchScaledPosition (this, pinch, scaleFactor);
                    ScaleAndRepositionChildViews (pinch, scaleFactor);
                    pinchesConsumed = true;
                }
            }

            return pinchesConsumed;
        }
Ejemplo n.º 3
0
        public virtual bool ConsumeGestures(GestureSamples gestureSamples)
        {
            bool gestureConsumed = false;

            if (IsTapEnabled) {
                List<GestureSample> taps = gestureSamples.GetSamples (GestureType.Tap);
                foreach (GestureSample tap in taps) {
                    if (IsGestureWithinView (tap)) {
                        OnTap (this);
                        gestureConsumed = true;
                        break;
                    }
                }
            }

            if (IsDoubleTapEnabled && ! gestureConsumed) {
                List<GestureSample> doubleTaps = gestureSamples.GetSamples (GestureType.DoubleTap);
                foreach (GestureSample doubleTap in doubleTaps) {
                    if (IsGestureWithinView (doubleTap)) {
                        OnDoubleTap (this);
                        gestureConsumed = true;
                        break;
                    }
                }
            }

            if (IsHoldEnabled && ! gestureConsumed) {
                List<GestureSample> holds = gestureSamples.GetSamples (GestureType.Hold);
                foreach (GestureSample hold in holds) {
                    if (IsGestureWithinView (hold)) {
                        OnHold (this);
                        gestureConsumed = true;
                        break;
                    }
                }
            }

            return gestureConsumed;
        }