| OLD | NEW |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 /** | 68 /** |
| 69 * Momentum Delegate interface. | 69 * Momentum Delegate interface. |
| 70 * You are required to implement this interface in order to use the | 70 * You are required to implement this interface in order to use the |
| 71 * Momentum behavior. | 71 * Momentum behavior. |
| 72 */ | 72 */ |
| 73 interface MomentumDelegate { | 73 interface MomentumDelegate { |
| 74 /** | 74 /** |
| 75 * Callback for a deceleration step. The delegate is responsible for redrawing | 75 * Callback for a deceleration step. The delegate is responsible for redrawing |
| 76 * the element in its new position specified in px. The [duration] of the | 76 * the element in its new position specified in px. |
| 77 * translation is in ms. | |
| 78 */ | 77 */ |
| 79 void onDecelerate(num x, num y, [num duration, String timingFunction]); | 78 void onDecelerate(num x, num y); |
| 80 | 79 |
| 81 /** | 80 /** |
| 82 * Callback for end of deceleration. | 81 * Callback for end of deceleration. |
| 83 */ | 82 */ |
| 84 void onDecelerationEnd(); | 83 void onDecelerationEnd(); |
| 85 } | 84 } |
| 86 | 85 |
| 87 class BouncingState { | 86 class BouncingState { |
| 88 static final NOT_BOUNCING = 0; | 87 static final NOT_BOUNCING = 0; |
| 89 static final BOUNCING_AWAY = 1; | 88 static final BOUNCING_AWAY = 1; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 544 |
| 546 Coordinate get destination() { | 545 Coordinate get destination() { |
| 547 if (!_moves.isEmpty()) { | 546 if (!_moves.isEmpty()) { |
| 548 final lastMove = _moves.last(); | 547 final lastMove = _moves.last(); |
| 549 return new Coordinate(lastMove.x, lastMove.y); | 548 return new Coordinate(lastMove.x, lastMove.y); |
| 550 } else { | 549 } else { |
| 551 return null; | 550 return null; |
| 552 } | 551 } |
| 553 } | 552 } |
| 554 } | 553 } |
| OLD | NEW |