• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "ui/events/gestures/gesture_util.h"
6 
7 #include <stdlib.h>
8 
9 #include "ui/events/gestures/gesture_configuration.h"
10 #include "ui/gfx/point.h"
11 
12 namespace ui {
13 namespace gestures {
14 
IsInsideManhattanSquare(const gfx::Point & p1,const gfx::Point & p2)15 bool IsInsideManhattanSquare(const gfx::Point& p1,
16                              const gfx::Point& p2) {
17   int manhattan_distance = abs(p1.x() - p2.x()) + abs(p1.y() - p2.y());
18   return manhattan_distance <
19       GestureConfiguration::max_touch_move_in_pixels_for_click();
20 }
21 
22 }  // namespace gestures
23 }  // namespace ui
24