Exemplo n.º 1
0
 internal _TapTracker(
     PointerDownEvent evt = null,
     GestureArenaEntry entry = null) {
     this.pointer = evt.pointer;
     this._initialPosition = evt.position;
     this.entry = entry;
 }
Exemplo n.º 2
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     startTrackingPointer(evt.pointer, evt.transform);
     _velocityTrackers[evt.pointer] = new VelocityTracker();
     if (_state == _DragState.ready)
     {
         _state                     = _DragState.possible;
         _initialPosition           = new OffsetPair(global: evt.position, local: evt.localPosition);
         _pendingDragOffset         = OffsetPair.zero;
         _globalDistanceMoved       = 0f;
         _lastPendingEventTimestamp = evt.timeStamp;
         _lastTransform             = evt.transform;
         if (onDown != null)
         {
             invokeCallback <object>("onDown",
                                     () => {
                 onDown(new DragDownDetails(
                            globalPosition: _initialPosition.global,
                            localPosition: _initialPosition.local));
                 return(null);
             });
         }
     }
     else if (_state == _DragState.accepted)
     {
         resolve(GestureDisposition.accepted);
     }
 }
Exemplo n.º 3
0
 void _reset()
 {
     _sentTapDown = false;
     _wonArenaForPrimaryPointer = false;
     _up   = null;
     _down = null;
 }
Exemplo n.º 4
0
        protected override void handleTapUp(PointerDownEvent down, PointerUpEvent up)
        {
            TapUpDetails details = new TapUpDetails(
                globalPosition: up.position,
                localPosition: up.localPosition,
                kind: up.kind,
                device: up.device
                );

            if (this.onTapUp != null)
            {
                this.invokeCallback <object>("onTapUp", () => {
                    this.onTapUp(details);
                    return(null);
                });
            }

            if (this.onTap != null)
            {
                this.invokeCallback <object>("onTap", () => {
                    this.onTap();
                    return(null);
                });
            }
        }
Exemplo n.º 5
0
 void _reset()
 {
     this._sentTapDown = false;
     this._wonArenaForPrimaryPointer = false;
     this._up   = null;
     this._down = null;
 }
Exemplo n.º 6
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     if (this.state == GestureRecognizerState.ready)
     {
         this._down = evt;
     }
     base.addAllowedPointer(evt);
 }
Exemplo n.º 7
0
 protected override void handleTapCancel(PointerDownEvent down, PointerCancelEvent cancel, string note)
 {
     if (this.onTapCancel != null)
     {
         this.invokeCallback <object>("onTapCancel", () => {
             this.onTapCancel();
             return(null);
         });
     }
 }
Exemplo n.º 8
0
 public void addPointer(PointerDownEvent evt)
 {
     if (this.isPointerAllowed(evt))
     {
         this.addAllowedPointer(evt);
     }
     else
     {
         this.handleNonAllowedPointer(evt);
     }
 }
Exemplo n.º 9
0
        public override void addAllowedPointer(PointerEvent evt)
        {
            var _evt = (PointerDownEvent)evt;

            D.assert(_evt != null);
            if (state == GestureRecognizerState.ready)
            {
                _down = _evt;
            }
            base.addAllowedPointer(_evt);
        }
Exemplo n.º 10
0
 internal _TapTracker(
     PointerDownEvent evt,
     TimeSpan doubleTapMinTime,
     GestureArenaEntry entry = null
     )
 {
     this.pointer = evt.pointer;
     this._initialGlobalPosition     = evt.position;
     this._doubleTapMinTimeCountdown = new _CountdownZoned(duration: doubleTapMinTime);
     this.entry = entry;
 }
Exemplo n.º 11
0
 public void addPointer(PointerDownEvent evt)
 {
     _pointerToKind[evt.pointer] = evt.kind;
     if (isPointerAllowed(evt))
     {
         addAllowedPointer(evt);
     }
     else
     {
         handleNonAllowedPointer(evt);
     }
 }
Exemplo n.º 12
0
 public void addPointer(PointerDownEvent evt)
 {
     this._pointerToKind[evt.pointer] = evt.kind;
     if (this.isPointerAllowed(evt))
     {
         this.addAllowedPointer(evt);
     }
     else
     {
         this.handleNonAllowedPointer(evt);
     }
 }
Exemplo n.º 13
0
        protected override bool isPointerAllowed(PointerDownEvent evt)
        {
            if (this.onTapDown == null &&
                this.onTap == null &&
                this.onTapUp == null &&
                this.onTapCancel == null)
            {
                return(false);
            }

            return(base.isPointerAllowed(evt));
        }
Exemplo n.º 14
0
        public override void addAllowedPointer(PointerDownEvent pEvent)
        {
            D.assert(this._pointers != null);
            D.assert(pEvent.position != null);
            D.assert(!this._pointers.ContainsKey(pEvent.pointer));

            T state = this.createNewPointerState(pEvent);

            this._pointers[pEvent.pointer] = state;
            GestureBinding.instance.pointerRouter.addRoute(pEvent.pointer, this._handleEvent);
            state._setArenaEntry(GestureBinding.instance.gestureArena.add(pEvent.pointer, this));
        }
Exemplo n.º 15
0
 internal _TapTracker(
     PointerDownEvent evt,
     TimeSpan doubleTapMinTime,
     GestureArenaEntry entry = null
     )
 {
     D.assert(evt != null);
     pointer = evt.pointer;
     _initialGlobalPosition     = evt.position;
     initialButtons             = evt.buttons;
     _doubleTapMinTimeCountdown = new _CountdownZoned(duration: doubleTapMinTime);
     this.entry = entry;
 }
Exemplo n.º 16
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     this.startTrackingPointer(evt.pointer, evt.transform);
     if (this.state == GestureRecognizerState.ready)
     {
         this.state           = GestureRecognizerState.possible;
         this.primaryPointer  = evt.pointer;
         this.initialPosition = new OffsetPair(local: evt.localPosition, global: evt.position);
         if (this.deadline != null)
         {
             this._timer = Window.instance.run(this.deadline.Value, () => didExceedDeadlineWithEvent(evt));
         }
     }
 }
Exemplo n.º 17
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     startTrackingPointer(evt.pointer, evt.transform);
     if (state == GestureRecognizerState.ready)
     {
         state           = GestureRecognizerState.possible;
         primaryPointer  = evt.pointer;
         initialPosition = new OffsetPair(local: evt.localPosition, global: evt.position);
         if (deadline != null)
         {
             _timer = Timer.create(deadline.Value, () => didExceedDeadlineWithEvent(evt));
         }
     }
 }
Exemplo n.º 18
0
        public override void addAllowedPointer(PointerDownEvent evt) {
            if (this._firstTap != null &&
                !this._firstTap.isWithinTolerance(evt, Constants.kDoubleTapSlop)) {
                return;
            }

            this._stopDoubleTapTimer();
            _TapTracker tracker = new _TapTracker(
                evt: evt,
                entry: GestureBinding.instance.gestureArena.add(evt.pointer, this)
            );
            this._trackers[evt.pointer] = tracker;
            tracker.startTrackingPointer(this._handleEvent);
        }
Exemplo n.º 19
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     this.startTrackingPointer(evt.pointer);
     if (this.state == GestureRecognizerState.ready)
     {
         this.state           = GestureRecognizerState.possible;
         this.primaryPointer  = evt.pointer;
         this.initialPosition = evt.position;
         if (this.deadline != null)
         {
             this._timer = Window.instance.run(this.deadline.Value, this.didExceedDeadline);
         }
     }
 }
Exemplo n.º 20
0
        protected override void handleTapDown(PointerDownEvent down)
        {
            if (this.onTapDown != null)
            {
                TapDownDetails details = new TapDownDetails(
                    globalPosition: down.position,
                    kind: down.kind,
                    device: down.device
                    );

                this.invokeCallback <object>("onTapDown", () => {
                    this.onTapDown(details);
                    return(null);
                });
            }
        }
Exemplo n.º 21
0
 public override void addAllowedPointer(PointerDownEvent Event)
 {
     if (!(Event is PointerUpEvent) && Event.pressureMax <= 1.0f)
     {
         resolve(GestureDisposition.rejected);
     }
     else
     {
         startTrackingPointer(Event.pointer, Event.transform);
         if (_state == _ForceState.ready)
         {
             _state        = _ForceState.possible;
             _lastPosition = OffsetPair.fromEventPosition(Event);
         }
     }
 }
Exemplo n.º 22
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     D.assert(!this._gestureMap.ContainsKey(evt.pointer));
     this._gestureMap[evt.pointer] = new _TapGesture(
         gestureRecognizer: this,
         evt: evt,
         longTapDelay: this.longTapDelay
         );
     if (this.onTapDown != null)
     {
         this.invokeCallback <object>("onTapDown", () => {
             this.onTapDown(evt.pointer, new TapDownDetails(globalPosition: evt.position));
             return(null);
         });
     }
 }
Exemplo n.º 23
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     this.startTrackingPointer(evt.pointer);
     this._velocityTrackers[evt.pointer] = new VelocityTracker();
     if (this._state == _ScaleState.ready)
     {
         this._state                 = _ScaleState.possible;
         this._initialSpan           = 0.0f;
         this._currentSpan           = 0.0f;
         this._initialHorizontalSpan = 0.0f;
         this._currentHorizontalSpan = 0.0f;
         this._initialVerticalSpan   = 0.0f;
         this._currentVerticalSpan   = 0.0f;
         this._pointerLocations      = new Dictionary <int, Offset>();
         this._pointerQueue          = new List <int>();
     }
 }
Exemplo n.º 24
0
        protected override bool isPointerAllowed(PointerDownEvent evt)
        {
            if (_firstTap == null)
            {
                switch (evt.buttons)
                {
                case gesture_.kPrimaryButton:
                    if (onDoubleTap == null)
                    {
                        return(false);
                    }
                    break;

                default:
                    return(false);
                }
            }

            return(base.isPointerAllowed(evt as PointerDownEvent));
        }
Exemplo n.º 25
0
        public override void addAllowedPointer(PointerDownEvent evt)
        {
            if (_firstTap != null)
            {
                if (!_firstTap.isWithinGlobalTolerance(evt, Constants.kDoubleTapSlop))
                {
                    // Ignore out-of-bounds second taps.
                    return;
                }
                else if (!_firstTap.hasElapsedMinTime() ||
                         !_firstTap.hasSameButton(evt as PointerDownEvent))
                {
                    // Restart when the second tap is too close to the first, or when buttons
                    // mismatch.
                    _reset();
                    _trackFirstTap(evt);
                    return;
                }
            }

            _trackFirstTap(evt);
        }
Exemplo n.º 26
0
 public override void addAllowedPointer(PointerDownEvent evt)
 {
     this.startTrackingPointer(evt.pointer);
     this._velocityTrackers[evt.pointer] = new VelocityTracker();
     if (this._state == _DragState.ready)
     {
         this._state                     = _DragState.possible;
         this._initialPosition           = evt.position;
         this._pendingDragOffset         = Offset.zero;
         this._lastPendingEventTimestamp = evt.timeStamp;
         if (this.onDown != null)
         {
             this.invokeCallback <object>("onDown",
                                          () => {
                 this.onDown(new DragDownDetails(globalPosition: this._initialPosition));
                 return(null);
             });
         }
     }
     else if (this._state == _DragState.accepted)
     {
         this.resolve(GestureDisposition.accepted);
     }
 }
Exemplo n.º 27
0
 protected bool isPointerAllowed(PointerDownEvent evt)
 {
     return(this._kind == null || this._kind == evt.kind);
 }
Exemplo n.º 28
0
 protected virtual void handleNonAllowedPointer(PointerDownEvent evt)
 {
 }
Exemplo n.º 29
0
 public abstract void addAllowedPointer(PointerDownEvent evt);
Exemplo n.º 30
0
 protected abstract void handleTapCancel(PointerDownEvent down, PointerCancelEvent cancel, string reason);