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

Unified Diff: samples/swarm/swarm_ui_lib/touch/Scroller.dart

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 12 months 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 side-by-side diff with in-line comments
Download patch
Index: samples/swarm/swarm_ui_lib/touch/Scroller.dart
diff --git a/samples/swarm/swarm_ui_lib/touch/Scroller.dart b/samples/swarm/swarm_ui_lib/touch/Scroller.dart
index 196d910854e6e0f2a632bde7d101e7872526b291..660d08ca08cfbf9846660a7f9de3039b5f5f23e1 100644
--- a/samples/swarm/swarm_ui_lib/touch/Scroller.dart
+++ b/samples/swarm/swarm_ui_lib/touch/Scroller.dart
@@ -351,8 +351,8 @@ class Scroller implements Draggable, MomentumDelegate {
void throwDelta(num deltaX, num deltaY, [num decelerationFactor = null]) {
Coordinate start = _contentOffset;
Coordinate end = currentTarget;
- int x = end.x.toInt();
- int y = end.y.toInt();
+ int x = end.x.truncate();
+ int y = end.y.truncate();
// If we are throwing in the opposite direction of the existing momentum,
// cancel the current momentum.
if (deltaX != 0 && deltaX.isNegative != (end.x - start.x).isNegative) {
@@ -361,8 +361,8 @@ class Scroller implements Draggable, MomentumDelegate {
if (deltaY != 0 && deltaY.isNegative != (end.y - start.y).isNegative) {
y = start.y;
}
- x += deltaX.toInt();
- y += deltaY.toInt();
+ x += deltaX.truncate();
+ y += deltaY.truncate();
throwTo(x, y, decelerationFactor);
}

Powered by Google App Engine
This is Rietveld 408576698