Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: client/touch/Momentum.dart

Issue 8666012: Partial fix to client breakage (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Implementations can be used to simulate the deceleration of an element within 6 * Implementations can be used to simulate the deceleration of an element within
7 * a certain region. To use this behavior you need to provide an initial 7 * a certain region. To use this behavior you need to provide an initial
8 * velocity that is meant to represent the gesture that is initiating this 8 * velocity that is meant to represent the gesture that is initiating this
9 * deceleration. You also provide the bounds of the region that the element 9 * deceleration. You also provide the bounds of the region that the element
10 * exists in, and the current offset of the element within that region. The 10 * exists in, and the current offset of the element within that region. The
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 num _stepTimeout; 373 num _stepTimeout;
374 bool _decelerating; 374 bool _decelerating;
375 MomentumDelegate _delegate; 375 MomentumDelegate _delegate;
376 int _nextY; 376 int _nextY;
377 int _nextX; 377 int _nextX;
378 Coordinate _minCoord; 378 Coordinate _minCoord;
379 Coordinate _maxCoord; 379 Coordinate _maxCoord;
380 num _customDecelerationFactor; 380 num _customDecelerationFactor;
381 num _defaultDecelerationFactor; 381 num _defaultDecelerationFactor;
382 382
383 TimeoutMomentum(this._delegate, [this._defaultDecelerationFactor = 1]) 383 TimeoutMomentum(this._delegate, [defaultDecelerationFactor = 1])
384 : _decelerating = false, 384 : _defaultDecelerationFactor = defaultDecelerationFactor,
385 _decelerating = false,
385 _moves = new Queue<_Move>(), 386 _moves = new Queue<_Move>(),
386 physicsX = new SingleDimensionPhysics(), 387 physicsX = new SingleDimensionPhysics(),
387 physicsY = new SingleDimensionPhysics(); 388 physicsY = new SingleDimensionPhysics();
388 389
389 /** 390 /**
390 * Calculate and return the moves for the deceleration motion. 391 * Calculate and return the moves for the deceleration motion.
391 */ 392 */
392 void _calculateMoves() { 393 void _calculateMoves() {
393 _moves.clear(); 394 _moves.clear();
394 num time = TimeUtil.now(); 395 num time = TimeUtil.now();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 545
545 Coordinate get destination() { 546 Coordinate get destination() {
546 if (!_moves.isEmpty()) { 547 if (!_moves.isEmpty()) {
547 final lastMove = _moves.last(); 548 final lastMove = _moves.last();
548 return new Coordinate(lastMove.x, lastMove.y); 549 return new Coordinate(lastMove.x, lastMove.y);
549 } else { 550 } else {
550 return null; 551 return null;
551 } 552 }
552 } 553 }
553 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698