summaryrefslogtreecommitdiffstats
path: root/ui/base/gestures/gesture_util.cc
blob: f4f003bae1260ce69ba0dd308e3405a1c39d38d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/base/gestures/gesture_util.h"

#include <stdlib.h>

#include "ui/base/gestures/gesture_configuration.h"
#include "ui/gfx/point.h"

namespace ui {
namespace gestures {

bool IsInsideManhattanSquare(const gfx::Point& p1,
                             const gfx::Point& p2) {
  int manhattan_distance = abs(p1.x() - p2.x()) + abs(p1.y() - p2.y());
  return manhattan_distance <
      GestureConfiguration::max_touch_move_in_pixels_for_click();
}

}  // namespace gestures
}  // namespace ui