OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/common/workspace/magnetism_matcher.h" | 5 #include "ash/common/wm/workspace/magnetism_matcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 namespace ash { | 10 namespace ash { |
11 namespace { | 11 namespace { |
12 | 12 |
13 // Returns true if |a| is close enough to |b| that the two edges snap. | 13 // Returns true if |a| is close enough to |b| that the two edges snap. |
14 bool IsCloseEnough(int a, int b) { | 14 bool IsCloseEnough(int a, int b) { |
15 return abs(a - b) <= MagnetismMatcher::kMagneticDistance; | 15 return abs(a - b) <= MagnetismMatcher::kMagneticDistance; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 edges_) && | 178 edges_) && |
179 IsCloseEnough(bounds.right(), src_bounds.right())) { | 179 IsCloseEnough(bounds.right(), src_bounds.right())) { |
180 *secondary_edge = SECONDARY_MAGNETISM_EDGE_TRAILING; | 180 *secondary_edge = SECONDARY_MAGNETISM_EDGE_TRAILING; |
181 } else { | 181 } else { |
182 *secondary_edge = SECONDARY_MAGNETISM_EDGE_NONE; | 182 *secondary_edge = SECONDARY_MAGNETISM_EDGE_NONE; |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 } // namespace ash | 187 } // namespace ash |
OLD | NEW |