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

Unified Diff: ui/gfx/android/scroller.cc

Issue 606093002: android scroller: Stop fling earlier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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
« no previous file with comments | « no previous file | ui/gfx/android/scroller_unittest.cc » ('j') | ui/gfx/gfx_tests.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/android/scroller.cc
diff --git a/ui/gfx/android/scroller.cc b/ui/gfx/android/scroller.cc
index 4a44741f52e86b85f92ec1e8102f1a881f3bfb0f..16453629a71ece039c1bc4819dde35d4f85af300 100644
--- a/ui/gfx/android/scroller.cc
+++ b/ui/gfx/android/scroller.cc
@@ -324,9 +324,11 @@ bool Scroller::ComputeScrollOffset(base::TimeTicks time) {
curr_y_ = start_y_ + distance_coef * delta_y_;
curr_y_ = Clamped(curr_y_, min_y_, max_y_);
- if (ApproxEquals(curr_x_, final_x_) && ApproxEquals(curr_y_, final_y_)) {
+ float diff_x = std::abs(curr_x_ - final_x_);
+ float diff_y = std::abs(curr_y_ - final_y_);
+ const float kThresholdForFlingEnd = 0.1;
jdduke (slow) 2014/09/26 22:19:53 Nit: Might as well stick this at the top with the
sadrul 2014/09/29 17:23:56 Done.
+ if (diff_x < kThresholdForFlingEnd && diff_y < kThresholdForFlingEnd)
finished_ = true;
- }
} break;
}
« no previous file with comments | « no previous file | ui/gfx/android/scroller_unittest.cc » ('j') | ui/gfx/gfx_tests.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698