| Index: samples/swarm/swarm_ui_lib/touch/Momentum.dart
|
| diff --git a/samples/swarm/swarm_ui_lib/touch/Momentum.dart b/samples/swarm/swarm_ui_lib/touch/Momentum.dart
|
| index 269b722e5b4f4a34eea6a36cc04aa2a3f8b9131f..034c025399ef74b42470c2c1a2660cce519c819f 100644
|
| --- a/samples/swarm/swarm_ui_lib/touch/Momentum.dart
|
| +++ b/samples/swarm/swarm_ui_lib/touch/Momentum.dart
|
| @@ -278,11 +278,11 @@ class SingleDimensionPhysics {
|
| velocity = v * _MS_PER_FRAME * _INITIAL_VELOCITY_BOOST_FACTOR;
|
|
|
| if (velocity.abs() < _MIN_VELOCITY) {
|
| - if (_minCoord !== null && _currentOffset < _minCoord) {
|
| + if (_minCoord != null && _currentOffset < _minCoord) {
|
| velocity = (_minCoord - _currentOffset) * _POST_BOUNCE_COEFFICIENT;
|
| velocity = Math.max(velocity, _MIN_STEP_VELOCITY);
|
| _bouncingState = BouncingState.BOUNCING_BACK;
|
| - } else if (_maxCoord !== null && _currentOffset > _maxCoord) {
|
| + } else if (_maxCoord != null && _currentOffset > _maxCoord) {
|
| velocity = (_currentOffset - _maxCoord) * _POST_BOUNCE_COEFFICIENT;
|
| velocity = -Math.max(velocity, _MIN_STEP_VELOCITY);
|
| _bouncingState = BouncingState.BOUNCING_BACK;
|
| @@ -306,10 +306,10 @@ class SingleDimensionPhysics {
|
| }
|
|
|
| num stretchDistance;
|
| - if (_minCoord !== null && _currentOffset < _minCoord) {
|
| + if (_minCoord != null && _currentOffset < _minCoord) {
|
| stretchDistance = _minCoord - _currentOffset;
|
| } else {
|
| - if (_maxCoord !== null && _currentOffset > _maxCoord) {
|
| + if (_maxCoord != null && _currentOffset > _maxCoord) {
|
| stretchDistance = _maxCoord - _currentOffset;
|
| }
|
| }
|
| @@ -334,7 +334,7 @@ class SingleDimensionPhysics {
|
| void step() {
|
| // It is common for scrolling to be disabled so in these cases we want to
|
| // avoid needless calculations.
|
| - if (velocity !== null) {
|
| + if (velocity != null) {
|
| _currentOffset += velocity;
|
| _adjustVelocity();
|
| }
|
| @@ -436,16 +436,16 @@ class TimeoutMomentum implements Momentum {
|
| bool start(Coordinate velocity, Coordinate minCoord, Coordinate maxCoord,
|
| Coordinate initialOffset, [num decelerationFactor = null]) {
|
| _customDecelerationFactor = _defaultDecelerationFactor;
|
| - if (decelerationFactor !== null) {
|
| + if (decelerationFactor != null) {
|
| _customDecelerationFactor = decelerationFactor;
|
| }
|
|
|
| - if (_stepTimeout !== null) {
|
| + if (_stepTimeout != null) {
|
| Env.cancelRequestAnimationFrame(_stepTimeout);
|
| _stepTimeout = null;
|
| }
|
|
|
| - assert (_stepTimeout === null);
|
| + assert (_stepTimeout == null);
|
| assert(minCoord.x <= maxCoord.x);
|
| assert(minCoord.y <= maxCoord.y);
|
| _previousOffset = initialOffset.clone();
|
| @@ -490,7 +490,7 @@ class TimeoutMomentum implements Momentum {
|
| // Prune moves that are more than 1 frame behind when we have more
|
| // available moves.
|
| num lastEpoch = timestamp - SingleDimensionPhysics._MS_PER_FRAME;
|
| - while (!_moves.isEmpty && _moves.first !== _moves.last
|
| + while (!_moves.isEmpty && !identical(_moves.first, _moves.last)
|
| && _moves.first.time < lastEpoch) {
|
| _moves.removeFirst();
|
| }
|
| @@ -500,7 +500,7 @@ class TimeoutMomentum implements Momentum {
|
| _delegate.onDecelerate(move.x, move.y);
|
| if (!_moves.isEmpty) {
|
| num nextTime = _moves.first.time;
|
| - assert(_stepTimeout === null);
|
| + assert(_stepTimeout == null);
|
| _stepTimeout = Env.requestAnimationFrame(_step, null, nextTime);
|
| } else {
|
| stop();
|
| @@ -511,7 +511,7 @@ class TimeoutMomentum implements Momentum {
|
| void abort() {
|
| _decelerating = false;
|
| _moves.clear();
|
| - if (_stepTimeout !== null) {
|
| + if (_stepTimeout != null) {
|
| Env.cancelRequestAnimationFrame(_stepTimeout);
|
| _stepTimeout = null;
|
| }
|
| @@ -533,7 +533,7 @@ class TimeoutMomentum implements Momentum {
|
| velocity = new Coordinate(0, 0);
|
| }
|
| _moves.clear();
|
| - if (_stepTimeout !== null) {
|
| + if (_stepTimeout != null) {
|
| Env.cancelRequestAnimationFrame(_stepTimeout);
|
| _stepTimeout = null;
|
| }
|
|
|