@any-touch/press
Advanced tools
Comparing version 0.6.0-beta.14 to 0.6.0-beta.15
@@ -1,13 +0,9 @@ | ||
'use strict'; | ||
import { __extends } from 'tslib'; | ||
import { INPUT_START, STATUS_RECOGNIZED, INPUT_END, DIRECTION_UP, INPUT_CANCEL, STATUS_FAILED } from '@any-touch/shared'; | ||
import ComputeDistance from '@any-touch/compute-distance'; | ||
import resetStatus from '@any-touch/reset-status-for-press-move-like'; | ||
import Recognizer from '@any-touch/recognizer'; | ||
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 compute = require('@any-touch/compute'); | ||
var Recognizer = require('@any-touch/recognizer'); | ||
var Recognizer__default = _interopDefault(Recognizer); | ||
var PressRecognizer = (function (_super) { | ||
tslib.__extends(PressRecognizer, _super); | ||
__extends(PressRecognizer, _super); | ||
function PressRecognizer(options) { | ||
@@ -21,16 +17,16 @@ if (options === void 0) { options = {}; } | ||
var deltaTime = input.timestamp - startInput.timestamp; | ||
if (shared.INPUT_START === inputType && this.test(input)) { | ||
Recognizer.resetStatusForPressMoveLike(this); | ||
if (INPUT_START === inputType && this.test(input)) { | ||
resetStatus(this); | ||
this.cancel(); | ||
this._timeoutId = setTimeout(function () { | ||
_this.status = shared.STATUS_RECOGNIZED; | ||
_this.status = STATUS_RECOGNIZED; | ||
emit(_this.options.name, input); | ||
}, this.options.minPressTime); | ||
} | ||
else if (shared.INPUT_END === inputType && shared.STATUS_RECOGNIZED === this.status) { | ||
emit("" + this.options.name + shared.DIRECTION_UP, this.computed); | ||
else if (INPUT_END === inputType && STATUS_RECOGNIZED === this.status) { | ||
emit("" + this.options.name + DIRECTION_UP, this.computed); | ||
} | ||
else if (!this.test(input) || (this.options.minPressTime > deltaTime && -1 !== [shared.INPUT_END, shared.INPUT_CANCEL].indexOf(inputType))) { | ||
else if (!this.test(input) || (this.options.minPressTime > deltaTime && -1 !== [INPUT_END, INPUT_CANCEL].indexOf(inputType))) { | ||
this.cancel(); | ||
this.status = shared.STATUS_FAILED; | ||
this.status = STATUS_FAILED; | ||
} | ||
@@ -40,3 +36,3 @@ }; | ||
var pointLength = input.pointLength; | ||
this.computed = this.compute([compute.ComputeDistance], input); | ||
this.computed = this.compute([ComputeDistance], input); | ||
var distance = this.computed.distance; | ||
@@ -55,4 +51,4 @@ return this.options.positionTolerance > distance && this.isValidPointLength(pointLength); | ||
return PressRecognizer; | ||
}(Recognizer__default)); | ||
}(Recognizer)); | ||
module.exports = PressRecognizer; | ||
export default PressRecognizer; |
{ | ||
"name": "@any-touch/press", | ||
"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,4 +5,5 @@ import { CommonEmitFunction, Input } from '@any-touch/shared/types'; | ||
} from '@any-touch/shared'; | ||
import { ComputeDistance } from '@any-touch/compute'; | ||
import Recognizer,{ resetStatusForPressMoveLike as resetStatus } from '@any-touch/recognizer'; | ||
import ComputeDistance from '@any-touch/compute-distance'; | ||
import resetStatus from '@any-touch/reset-status-for-press-move-like'; | ||
import Recognizer from '@any-touch/recognizer'; | ||
@@ -9,0 +10,0 @@ export default class PressRecognizer 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
6617
5
129