public override bool applyContentDimensions(float minScrollExtent, float maxScrollExtent) { if (!PhysicsUtils.nearEqual(this._minScrollExtent, minScrollExtent, Tolerance.defaultTolerance.distance) || !PhysicsUtils.nearEqual(this._maxScrollExtent, maxScrollExtent, Tolerance.defaultTolerance.distance) || this._didChangeViewportDimensionOrReceiveCorrection) { this._minScrollExtent = minScrollExtent; this._maxScrollExtent = maxScrollExtent; this._haveDimensions = true; this.applyNewDimensions(); this._didChangeViewportDimensionOrReceiveCorrection = false; } return(true); }
void _tickDisplacement(TimeSpan elapsed) { if (_displacementTickerLastElapsed != null) { float?t = elapsed.Milliseconds - _displacementTickerLastElapsed?.Milliseconds; _displacement = _displacementTarget - (_displacementTarget - _displacement) * Mathf.Pow(2.0f, (-t ?? 0.0f) / _crossAxisHalfTime.Milliseconds); notifyListeners(); } if (PhysicsUtils.nearEqual(_displacementTarget, _displacement, Tolerance.defaultTolerance.distance)) { _displacementTicker.stop(); _displacementTickerLastElapsed = null; } else { _displacementTickerLastElapsed = elapsed; } }
public override IPromise animateTo(float to, TimeSpan duration, Curve curve ) { if (PhysicsUtils.nearEqual(to, this.pixels, this.physics.tolerance.distance)) { this.jumpTo(to); return(Promise.Resolved()); } DrivenScrollActivity activity = new DrivenScrollActivity( this, from: this.pixels, to: to, duration: duration, curve: curve, vsync: this.context.vsync ); this.beginActivity(activity); return(activity.done); }
public override Future animateTo( float to, TimeSpan duration, Curve curve ) { if (PhysicsUtils.nearEqual(to, pixels, physics.tolerance.distance)) { jumpTo(to); return(Future.value()); } DrivenScrollActivity activity = new DrivenScrollActivity( this, from: pixels, to: to, duration: duration, curve: curve, vsync: context.vsync ); beginActivity(activity); return(activity.done); }