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; |
} |