Socket
Socket
Sign inDemoInstall

@any-touch/pinch

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@any-touch/pinch - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

18

dist/index.d.ts

@@ -1,2 +0,3 @@

import type { RecognizerOptions, RecognizerFunction } from '@any-touch/shared';
import type { Computed, EventTrigger } from '@any-touch/shared';
import Recognizer from '@any-touch/recognizer';
declare const DEFAULT_OPTIONS: {

@@ -7,3 +8,16 @@ name: string;

};
export default function Pinch(options?: RecognizerOptions<typeof DEFAULT_OPTIONS>): ReturnType<RecognizerFunction>;
export default class extends Recognizer {
constructor(options: Partial<typeof DEFAULT_OPTIONS>);
/**
* 识别条件
* @param computed 计算数据
* @param 是否符合
*/
test(computed: Computed): boolean;
/**
* 开始识别
* @param computed 计算结果
*/
recognize(computed: Computed, emit: EventTrigger): void;
}
export {};

41

dist/index.es.js

@@ -1,4 +0,4 @@

import { __read } from 'tslib';
import { __extends, __assign } from 'tslib';
import { ComputeScale } from '@any-touch/compute';
import createContext, { canResetStatusForPressMoveLike, recognizeForPressMoveLike } from '@any-touch/recognizer';
import Recognizer, { recognizeForPressMoveLike } from '@any-touch/recognizer';

@@ -10,22 +10,21 @@ var DEFAULT_OPTIONS = {

};
function Pinch(options) {
var _context = createContext(DEFAULT_OPTIONS, options);
var _isRecognized = false;
function _test(computed) {
var default_1 = (function (_super) {
__extends(default_1, _super);
function default_1(options) {
var _this = _super.call(this, __assign(__assign({}, DEFAULT_OPTIONS), options)) || this;
_this.computeFunctions = [ComputeScale];
return _this;
}
default_1.prototype.test = function (computed) {
var pointLength = computed.pointLength, scale = computed.scale;
return (_context.pointLength === pointLength &&
void 0 !== scale &&
(_context.threshold < Math.abs(scale - 1) || _isRecognized));
}
function _recognize(computed, emit) {
_context.status = canResetStatusForPressMoveLike(_context.status);
recognizeForPressMoveLike(computed, _test, _context.name, _context.status, emit, function (_a) {
var _b = __read(_a, 2), isRecognized = _b[0], status = _b[1];
_context.status = status;
_isRecognized = isRecognized;
});
}
return [_context, _recognize, [ComputeScale]];
}
return this.isValidPointLength(pointLength)
&& void 0 !== scale
&& (this.options.threshold < Math.abs(scale - 1) || this.isRecognized);
};
default_1.prototype.recognize = function (computed, emit) {
recognizeForPressMoveLike(this, computed, emit);
};
return default_1;
}(Recognizer));
export default Pinch;
export default default_1;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("@any-touch/compute"),n=require("@any-touch/recognizer"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,s={name:"pinch",threshold:0,pointLength:2};exports.default=function(e){var u=o(s,e),a=!1;function i(e){var t=e.pointLength,r=e.scale;return u.pointLength===t&&void 0!==r&&(u.threshold<Math.abs(r-1)||a)}return[u,function(e,r){u.status=n.canResetStatusForPressMoveLike(u.status),n.recognizeForPressMoveLike(e,i,u.name,u.status,r,(function(e){var r=t.__read(e,2),n=r[0],o=r[1];u.status=o,a=n}))},[r.ComputeScale]]};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),i=require("@any-touch/compute"),o=require("@any-touch/recognizer"),n=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,r={name:"pinch",threshold:0,pointLength:2},s=function(e){function n(o){var n=e.call(this,t.__assign(t.__assign({},r),o))||this;return n.computeFunctions=[i.ComputeScale],n}return t.__extends(n,e),n.prototype.test=function(e){var t=e.pointLength,i=e.scale;return this.isValidPointLength(t)&&void 0!==i&&(this.options.threshold<Math.abs(i-1)||this.isRecognized)},n.prototype.recognize=function(e,t){o.recognizeForPressMoveLike(this,e,t)},n}(n);exports.default=s;
{
"name": "@any-touch/pinch",
"version": "1.0.4",
"version": "1.0.5",
"description": "any-touch的识别器, 用来识别捏合手势.",

@@ -17,5 +17,4 @@ "main": "./dist/index",

"dependencies": {
"@any-touch/compute": "^1.0.4",
"@any-touch/recognizer": "^1.0.4",
"tslib": "^2.0.1"
"@any-touch/compute": "^1.0.5",
"@any-touch/recognizer": "^1.0.5"
},

@@ -26,3 +25,3 @@ "publishConfig": {

"sideEffects": false,
"gitHead": "bf4837c370cf89353eff7911b7d2c772198fa301"
"gitHead": "bf4d9191714dd0852ca76a335d5a232af36a691e"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc