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