OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/gesture_detection/snap_scroll_controller.h" | 5 #include "ui/events/gesture_detection/snap_scroll_controller.h" |
6 | 6 |
| 7 #include <algorithm> |
7 #include <cmath> | 8 #include <cmath> |
8 | 9 |
9 #include "ui/events/gesture_detection/motion_event.h" | 10 #include "ui/events/gesture_detection/motion_event.h" |
10 | 11 |
11 namespace ui { | 12 namespace ui { |
12 namespace { | 13 namespace { |
13 | 14 |
14 // Minimum ratio between initial X and Y motion to allow snapping. | 15 // Minimum ratio between initial X and Y motion to allow snapping. |
15 const float kMinSnapRatio = 1.25f; | 16 const float kMinSnapRatio = 1.25f; |
16 | 17 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 116 |
116 bool SnapScrollController::IsSnapHorizontal() const { | 117 bool SnapScrollController::IsSnapHorizontal() const { |
117 return mode_ == SNAP_HORIZ; | 118 return mode_ == SNAP_HORIZ; |
118 } | 119 } |
119 | 120 |
120 bool SnapScrollController::IsSnappingScrolls() const { | 121 bool SnapScrollController::IsSnappingScrolls() const { |
121 return IsSnapHorizontal() || IsSnapVertical(); | 122 return IsSnapHorizontal() || IsSnapVertical(); |
122 } | 123 } |
123 | 124 |
124 } // namespace ui | 125 } // namespace ui |
OLD | NEW |