@any-touch/tap
Advanced tools
Comparing version 0.6.0-beta.14 to 0.6.0-beta.15
@@ -1,13 +0,10 @@ | ||
'use strict'; | ||
import { __extends, __assign } from 'tslib'; | ||
import { INPUT_END, STATUS_POSSIBLE, STATUS_RECOGNIZED, STATUS_FAILED } from '@any-touch/shared'; | ||
import Recognizer from '@any-touch/recognizer'; | ||
import { getVLength } from '@any-touch/vector'; | ||
import ComputeDistance from '@any-touch/compute-distance'; | ||
import ComputeMaxLength from '@any-touch/compute-max-length'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var tslib = require('tslib'); | ||
var shared = require('@any-touch/shared'); | ||
var Recognizer = _interopDefault(require('@any-touch/recognizer')); | ||
var vector = require('@any-touch/vector'); | ||
var compute = require('@any-touch/compute'); | ||
var TapRecognizer = (function (_super) { | ||
tslib.__extends(TapRecognizer, _super); | ||
__extends(TapRecognizer, _super); | ||
function TapRecognizer(options) { | ||
@@ -21,3 +18,3 @@ if (options === void 0) { options = {}; } | ||
if (void 0 !== this.prevTapPoint) { | ||
var distanceFromPreviousTap = vector.getVLength({ x: center.x - this.prevTapPoint.x, y: center.y - this.prevTapPoint.y }); | ||
var distanceFromPreviousTap = getVLength({ x: center.x - this.prevTapPoint.x, y: center.y - this.prevTapPoint.y }); | ||
this.prevTapPoint = center; | ||
@@ -45,6 +42,6 @@ return this.options.tapsPositionTolerance >= distanceFromPreviousTap; | ||
var inputType = input.inputType, x = input.x, y = input.y; | ||
this.computed = this.compute([compute.ComputeMaxLength, compute.ComputeDistance], input); | ||
if (shared.INPUT_END !== inputType) | ||
this.computed = this.compute([ComputeMaxLength, ComputeDistance], input); | ||
if (INPUT_END !== inputType) | ||
return; | ||
this.status = shared.STATUS_POSSIBLE; | ||
this.status = STATUS_POSSIBLE; | ||
if (this.test(input)) { | ||
@@ -59,4 +56,4 @@ this.cancelCountDownToFail(); | ||
if (0 === this.tapCount % this.options.tapTimes) { | ||
this.status = shared.STATUS_RECOGNIZED; | ||
emit(this.options.name, tslib.__assign(tslib.__assign({}, this.computed), { tapCount: this.tapCount })); | ||
this.status = STATUS_RECOGNIZED; | ||
emit(this.options.name, __assign(__assign({}, this.computed), { tapCount: this.tapCount })); | ||
this.reset(); | ||
@@ -70,3 +67,3 @@ } | ||
this.reset(); | ||
this.status = shared.STATUS_FAILED; | ||
this.status = STATUS_FAILED; | ||
} | ||
@@ -77,3 +74,3 @@ }; | ||
this._countDownToFailTimer = setTimeout(function () { | ||
_this.status = shared.STATUS_FAILED; | ||
_this.status = STATUS_FAILED; | ||
_this.reset(); | ||
@@ -111,2 +108,2 @@ }, this.options.waitNextTapTime); | ||
module.exports = TapRecognizer; | ||
export default TapRecognizer; |
{ | ||
"name": "@any-touch/tap", | ||
"version": "0.6.0-beta.14", | ||
"version": "0.6.0-beta.15", | ||
"description": "any-touch的识别器, 用来识别点击手势.", | ||
@@ -16,3 +16,3 @@ "main": "./dist/index", | ||
}, | ||
"gitHead": "0abbd642603961f0d1d10841352073ad411984ec" | ||
"gitHead": "faf40f62eec8920b65663feadc76d6aefa40e06c" | ||
} |
@@ -5,7 +5,8 @@ import { Point, Input } from '@any-touch/shared/types'; | ||
STATUS_POSSIBLE, | ||
STATUS_FAILED,INPUT_END | ||
STATUS_FAILED, INPUT_END | ||
} from '@any-touch/shared'; | ||
import Recognizer from '@any-touch/recognizer'; | ||
import {getVLength} from '@any-touch/vector'; | ||
import {ComputeDistance,ComputeMaxLength} from '@any-touch/compute'; | ||
import { getVLength } from '@any-touch/vector'; | ||
import ComputeDistance from '@any-touch/compute-distance'; | ||
import ComputeMaxLength from '@any-touch/compute-max-length'; | ||
@@ -12,0 +13,0 @@ export default class TapRecognizer extends Recognizer { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15191
5
368