Socket
Socket
Sign inDemoInstall

@any-touch/pinch

Package Overview
Dependencies
5
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.15 to 2.0.0-alpha.0

28

dist/index.d.ts

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

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

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

};
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;
}
/**
* "啮合"识别器
* @param at AnyTouch实例
* @param options 识别器选项
* @returns
*/
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): import("@any-touch/shared").PluginContext<{
name: string;
threshold: number;
pointLength: number;
}>;
export {};

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

import { __extends, __assign } from 'tslib';
import { ComputeScale } from '@any-touch/compute';
import Recognizer, { recognizeForPressMoveLike } from '@any-touch/recognizer';
var DEFAULT_OPTIONS = {
name: 'pinch',
threshold: 0,
pointLength: 2,
};
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 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 default_1;
import{createPluginContext as t,resetState as e,isDisabled as a,isRecognized as o,TYPE_END as n,TYPE_CANCEL as r,flow as h,getStatusName as i}from"@any-touch/shared";import{ComputeVectorForMutli as s,ComputeScale as p}from"@any-touch/compute";var c={name:"pinch",threshold:0,pointLength:2};export default function(m,u){var d=t(c,u);return m.compute([s,p],(function(t){if(e(d),!a(d)){var s,p,c,u,l=(s=t.pointLength,p=t.scale,c=t.deltaScale,u=t.phase,d.pointLength===s&&(void 0!==p&&void 0!==c&&d.threshold<Math.abs(p-1)||o(d.state))||o(d.state)&&[n,r].includes(u));d.state=h(l,d.state,t.phase);var v=d.name;l&&m.emit2(v,t,d);var f=i(d.state);f&&m.emit2(v+f,t,d)}})),d}

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

"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;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@any-touch/shared"),t=require("@any-touch/compute"),a={name:"pinch",threshold:0,pointLength:2};exports.default=function(o,i){var s=e.createPluginContext(a,i);return o.compute([t.ComputeVectorForMutli,t.ComputeScale],(function(t){if(e.resetState(s),!e.isDisabled(s)){var a,i,r,n,u=(a=t.pointLength,i=t.scale,r=t.deltaScale,n=t.phase,s.pointLength===a&&(void 0!==i&&void 0!==r&&s.threshold<Math.abs(i-1)||e.isRecognized(s.state))||e.isRecognized(s.state)&&[e.TYPE_END,e.TYPE_CANCEL].includes(n));s.state=e.flow(u,s.state,t.phase);var c=s.name;u&&o.emit2(c,t,s);var h=e.getStatusName(s.state);h&&o.emit2(c+h,t,s)}})),s};
{
"name": "@any-touch/pinch",
"version": "1.0.15",
"version": "2.0.0-alpha.0",
"description": "any-touch的识别器, 用来识别捏合手势.",

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

"dependencies": {
"@any-touch/compute": "^1.0.15",
"@any-touch/recognizer": "^1.0.15"
"@any-touch/compute": "^2.0.0-alpha.0",
"@any-touch/recognizer": "^1.0.14"
},

@@ -22,3 +22,3 @@ "publishConfig": {

"sideEffects": false,
"gitHead": "20d54f8303eda39f4ef4efdd1f5e2aadde0c713e"
"gitHead": "3fb899bb8ad845ab52fa4a932cc895637e173723"
}

@@ -8,8 +8,8 @@ # @any-touch/pinch

import Core from '@any-touch/core';
import Pinch from '@any-touch/pinch';
Core.use(Pinch, 参数)
import pinch from '@any-touch/pinch';
Core.use(pinch, 参数)
const at = new Core(el);
// 拖拽
at.on('pinch', (ev) => {
// ev包含位置/速度/方向等信息
at.on('pinch', (event) => {
// event包含位置/速度/方向等信息
});

@@ -16,0 +16,0 @@ ```

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc