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/views/view_targeter_delegate.h" | 5 #include "ui/views/view_targeter_delegate.h" |
6 | 6 |
| 7 #include <limits.h> |
| 8 |
7 #include "ui/gfx/geometry/rect_conversions.h" | 9 #include "ui/gfx/geometry/rect_conversions.h" |
8 #include "ui/views/rect_based_targeting_utils.h" | 10 #include "ui/views/rect_based_targeting_utils.h" |
9 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
10 | 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 // The minimum percentage of a view's area that needs to be covered by a rect | 15 // The minimum percentage of a view's area that needs to be covered by a rect |
14 // representing a touch region in order for that view to be considered by the | 16 // representing a touch region in order for that view to be considered by the |
15 // rect-based targeting algorithm. | 17 // rect-based targeting algorithm. |
16 static const float kRectTargetOverlap = 0.6f; | 18 static const float kRectTargetOverlap = 0.6f; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int cur_dist = views::DistanceSquaredFromCenterToPoint(touch_center, | 97 int cur_dist = views::DistanceSquaredFromCenterToPoint(touch_center, |
96 local_bounds); | 98 local_bounds); |
97 if (!rect_view || cur_dist < rect_view_distance) | 99 if (!rect_view || cur_dist < rect_view_distance) |
98 rect_view = root; | 100 rect_view = root; |
99 } | 101 } |
100 | 102 |
101 return rect_view ? rect_view : point_view; | 103 return rect_view ? rect_view : point_view; |
102 } | 104 } |
103 | 105 |
104 } // namespace views | 106 } // namespace views |
OLD | NEW |