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); }
protected override void handleEvent(PointerEvent evt) { D.assert(_state != _ScaleState.ready); bool didChangeConfiguration = false; bool shouldStartIfAccepted = false; if (evt is PointerMoveEvent) { VelocityTracker tracker = _velocityTrackers[evt.pointer]; D.assert(tracker != null); if (!evt.synthesized) { tracker.addPosition(evt.timeStamp, evt.position); } _pointerLocations[evt.pointer] = evt.position; shouldStartIfAccepted = true; _lastTransform = evt.transform; } else if (evt is PointerDownEvent) { _pointerLocations[evt.pointer] = evt.position; _pointerQueue.Add(evt.pointer); didChangeConfiguration = true; shouldStartIfAccepted = true; _lastTransform = evt.transform; } else if (evt is PointerUpEvent || evt is PointerCancelEvent) { _pointerLocations.Remove(evt.pointer); _pointerQueue.Remove(evt.pointer); didChangeConfiguration = true; _lastTransform = evt.transform; } _updateLines(); _update(); if (!didChangeConfiguration || _reconfigure(evt.pointer)) { _advanceStateMachine(shouldStartIfAccepted); } stopTrackingIfPointerNoLongerDown(evt); }