'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports['default'] = isTap;

var _euclidean_distance = require('./euclidean_distance');

var _euclidean_distance2 = _interopRequireDefault(_euclidean_distance);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var TOLERANCE = 25; /**
                     * @文件说明: 判断是否为Tap触摸轻敲操作
                     * @创建人: pjtools@vip.qq.com
                     * @创建时间: 2020-05-22 14:30:05
                     */

var INTERVAL = 250;

function isTap(start, end) {
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

  var tolerance = options.tolerance != null ? options.tolerance : TOLERANCE;
  var interval = options.interval != null ? options.interval : INTERVAL;

  start.point = start.point || end.point;
  start.time = start.time || end.time;
  var moveDistance = (0, _euclidean_distance2['default'])(start.point, end.point);

  return moveDistance < tolerance && end.time - start.time < interval;
}