Exemplo n.º 1
0
        bool _reconfigure(int pointer)
        {
            this._initialFocalPoint     = this._currentFocalPoint;
            this._initialSpan           = this._currentSpan;
            this._initialLine           = this._currentLine;
            this._initialHorizontalSpan = this._currentHorizontalSpan;
            this._initialVerticalSpan   = this._currentVerticalSpan;
            if (this._state == _ScaleState.started)
            {
                if (this.onEnd != null)
                {
                    VelocityTracker tracker = this._velocityTrackers[pointer];
                    D.assert(tracker != null);

                    Velocity velocity = tracker.getVelocity();
                    if (_ScaleGestureUtils._isFlingGesture(velocity))
                    {
                        Offset pixelsPerSecond = velocity.pixelsPerSecond;
                        if (pixelsPerSecond.distanceSquared >
                            Constants.kMaxFlingVelocity * Constants.kMaxFlingVelocity)
                        {
                            velocity = new Velocity(
                                pixelsPerSecond: (pixelsPerSecond / pixelsPerSecond.distance) *
                                Constants.kMaxFlingVelocity);
                        }

                        this.invokeCallback <object>("onEnd", () => {
                            this.onEnd(new ScaleEndDetails(velocity: velocity));
                            return(null);
                        });
                    }
                    else
                    {
                        this.invokeCallback <object>("onEnd", () => {
                            this.onEnd(new ScaleEndDetails(velocity: Velocity.zero));
                            return(null);
                        });
                    }
                }

                this._state = _ScaleState.accepted;
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
 public void _up()
 {
     D.assert(_arenaEntry != null);
     if (_client != null)
     {
         D.assert(pendingDelta == null);
         DragEndDetails details = new DragEndDetails(velocity: _velocityTracker.getVelocity());
         Drag           client  = _client;
         _client = null;
         client.end(details);
     }
     else
     {
         D.assert(pendingDelta != null);
         _pendingDelta = null;
         _lastPendingEventTimestamp = null;
     }
 }