-
This commit is contained in:
parent
63f31530fc
commit
a65f393ff1
132
node_modules/.package-lock.json
generated
vendored
Normal file
132
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
{
|
||||
"name": "canvas",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@any-touch/compute": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/compute/-/compute-2.2.0.tgz",
|
||||
"integrity": "sha512-hrw74b/cVT8SmiKFLValmllajw+bBvTa5iUwIXFVVIJM9T3tO15zZC2QbjVz8Uwi6XjH932RDUILGMs2TNvyQg==",
|
||||
"dependencies": {
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"@any-touch/vector": "^2.2.0",
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/core": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/core/-/core-2.2.0.tgz",
|
||||
"integrity": "sha512-xMHAA5aLCatFto+4fQWyE4YAsyN/LsXS4mnYuVpqFYoNz8dl5FsB/TIyb9JrqMKLYMxxcZ9joqR8gDprH1lwBw==",
|
||||
"dependencies": {
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"any-event": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/doubletap": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/doubletap/-/doubletap-2.2.0.tgz",
|
||||
"integrity": "sha512-g/Aj/4K2EocalpyKWoUL2HyxI+oJyO+6UwJvEvSpOTdjQXLnK155C0JhxC4pBAJS3yIwFXwU+/2ecagUABWTug==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"@any-touch/vector": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/pan": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/pan/-/pan-2.2.0.tgz",
|
||||
"integrity": "sha512-uMkCHbTm5qWji/FvhumP9n1ZCkPU7hy864g+ZhoWZ0OWAmn7s/TKRo4UqPBfqEPUMV6obGZvatrrgBLWT6J57w==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/pinch": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/pinch/-/pinch-2.2.0.tgz",
|
||||
"integrity": "sha512-TVLbjvdH2/lKUDSEOqPUi7VoXqAKn1MtsVNHNedpY//vv39Y9+OTfG/6qQoaH8ZS3g/C8cLyoGDu8W9P95b9zQ==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/press": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/press/-/press-2.2.0.tgz",
|
||||
"integrity": "sha512-+iIxniO6wrCh621fScGXARgjCxjn/XpqfwxHd7Pq7MVJl51sFrQu1pxWOk6j/I+FA3YfPU9kInO2H45BADWBXw==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/rotate": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/rotate/-/rotate-2.2.0.tgz",
|
||||
"integrity": "sha512-tRph/mSYWXFtrwwtpNzuIcjlyXh1sQvJf/XGJCBVEmi+ePWZRTIc7OV9fLOVZSfXui/9Z+9UYSTSZHJw31skyg==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/shared": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/shared/-/shared-2.2.0.tgz",
|
||||
"integrity": "sha512-2n1zWaATi/3osr/dkIUq5O7aSffKUsTM4DsIbPMW1VEO77v/rX2HkLoxt2Djzj5eCGh7An55Vw8NeA33kTTSRA=="
|
||||
},
|
||||
"node_modules/@any-touch/swipe": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/swipe/-/swipe-2.2.0.tgz",
|
||||
"integrity": "sha512-AzHKVuUpZzIaFUq4D4jXSaqfSyKEM/ipqnwKv4439z7R7OKWD5n8sI3T5jDDGKaUe+IIoOYVOgmwPDVCflfw4Q==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/tap": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/tap/-/tap-2.2.0.tgz",
|
||||
"integrity": "sha512-x+FIa/0iaKdXI6aKosThWmuGgPYX9U+QFO3Xp1xBjIMmKevDBOqVzFFFDMj8BU0fuY0aU8a+UfVKpMnar6Y87Q==",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"@any-touch/vector": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@any-touch/vector": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@any-touch/vector/-/vector-2.2.0.tgz",
|
||||
"integrity": "sha512-t7pGYegIDCJl+swwsohZHZKmF71ZMt+hjwVEyhaEP6nQhcx6S7zulxnRxNp1t8s+c/JdK02Q89HnzQ4Ukg4+IA==",
|
||||
"dependencies": {
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/any-event": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/any-event/-/any-event-2.2.0.tgz",
|
||||
"integrity": "sha512-PB4sEiVUjL+5mLmwlAGYdI5/1ouckapxS6+RPIvrGXv9XTMav7M3k3rR/f9fwAR+e2608CTR3FOR5HrOEYTtKA==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/any-touch": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/any-touch/-/any-touch-2.2.0.tgz",
|
||||
"integrity": "sha512-UnqDiRHefksz5K/Vnv8NAJX1xrQvA8Cpe4auwMs/EyI3rJlW3uo8eGYcLcU2AOBmwxBQh/aTtFondkkPmi1vcg==",
|
||||
"dependencies": {
|
||||
"@any-touch/core": "^2.2.0",
|
||||
"@any-touch/doubletap": "^2.2.0",
|
||||
"@any-touch/pan": "^2.2.0",
|
||||
"@any-touch/pinch": "^2.2.0",
|
||||
"@any-touch/press": "^2.2.0",
|
||||
"@any-touch/rotate": "^2.2.0",
|
||||
"@any-touch/swipe": "^2.2.0",
|
||||
"@any-touch/tap": "^2.2.0",
|
||||
"any-event": "^2.2.0",
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||
}
|
||||
}
|
||||
}
|
21
node_modules/@any-touch/compute/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/compute/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
2
node_modules/@any-touch/compute/README.md
generated
vendored
Normal file
2
node_modules/@any-touch/compute/README.md
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# @any-touch/compute
|
||||
计算相关的函数, 比如计算距离和旋转角度.
|
9
node_modules/@any-touch/compute/dist/ComputeAngle.d.ts
generated
vendored
Normal file
9
node_modules/@any-touch/compute/dist/ComputeAngle.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import type { Input, Computed } from '@any-touch/shared';
|
||||
/**
|
||||
* 计算角度
|
||||
* @param input 输入
|
||||
*/
|
||||
export default function ComputeAngle(): (input: Input, computed: Computed) => {
|
||||
angle: number;
|
||||
deltaAngle: number;
|
||||
};
|
6
node_modules/@any-touch/compute/dist/ComputeDeltaXY.d.ts
generated
vendored
Normal file
6
node_modules/@any-touch/compute/dist/ComputeDeltaXY.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import type { Input } from '@any-touch/shared';
|
||||
export default function (): (input: Input) => {
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
deltaXYAngle: number;
|
||||
};
|
9
node_modules/@any-touch/compute/dist/ComputeDistance.d.ts
generated
vendored
Normal file
9
node_modules/@any-touch/compute/dist/ComputeDistance.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import type { Input, directionString } from '@any-touch/shared';
|
||||
export default function (): (input: Input) => {
|
||||
displacementX: number;
|
||||
displacementY: number;
|
||||
distanceX: number;
|
||||
distanceY: number;
|
||||
distance: number;
|
||||
overallDirection?: directionString;
|
||||
};
|
5
node_modules/@any-touch/compute/dist/ComputeMaxLength.d.ts
generated
vendored
Normal file
5
node_modules/@any-touch/compute/dist/ComputeMaxLength.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { Input } from '@any-touch/shared';
|
||||
declare function ComputeMaxLength(): (input: Input) => {
|
||||
maxPointLength: number;
|
||||
};
|
||||
export default ComputeMaxLength;
|
5
node_modules/@any-touch/compute/dist/ComputeScale.d.ts
generated
vendored
Normal file
5
node_modules/@any-touch/compute/dist/ComputeScale.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import type { Input, Computed } from '@any-touch/shared';
|
||||
export default function (): (input: Input, computed: Computed) => {
|
||||
scale: number;
|
||||
deltaScale: number;
|
||||
};
|
8
node_modules/@any-touch/compute/dist/ComputeVAndDir.d.ts
generated
vendored
Normal file
8
node_modules/@any-touch/compute/dist/ComputeVAndDir.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
import type { Input, directionString } from '@any-touch/shared';
|
||||
export default function (): (input: Input) => {
|
||||
velocityX: number;
|
||||
velocityY: number;
|
||||
speedX: number;
|
||||
speedY: number;
|
||||
direction: directionString;
|
||||
};
|
11
node_modules/@any-touch/compute/dist/ComputeVectorForMutli.d.ts
generated
vendored
Normal file
11
node_modules/@any-touch/compute/dist/ComputeVectorForMutli.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import type { Input } from '@any-touch/shared';
|
||||
/**
|
||||
*
|
||||
* @param input 输入
|
||||
* @returns 记录多点输入时的"起/上一个/终"向量
|
||||
*/
|
||||
export default function (): (input: Input) => {
|
||||
startVecotr: import("@any-touch/shared").Point;
|
||||
prevVecotr: import("@any-touch/shared").Point;
|
||||
activeVecotr: import("@any-touch/shared").Point;
|
||||
};
|
7
node_modules/@any-touch/compute/dist/index.d.ts
generated
vendored
Normal file
7
node_modules/@any-touch/compute/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
export { default as ComputeAngle } from './ComputeAngle';
|
||||
export { default as ComputeDeltaXY } from './ComputeDeltaXY';
|
||||
export { default as ComputeDistance } from './ComputeDistance';
|
||||
export { default as ComputeScale } from './ComputeScale';
|
||||
export { default as ComputeVAndDir } from './ComputeVAndDir';
|
||||
export { default as ComputeMaxLength } from './ComputeMaxLength';
|
||||
export { default as ComputeVectorForMutli } from './ComputeVectorForMutli';
|
2
node_modules/@any-touch/compute/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/compute/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{getAngle as t,radianToAngle as n,getVLength as e,getDirection as o}from"@any-touch/vector";import{TYPE_START as r,TYPE_MOVE as i,CLIENT_X as a,CLIENT_Y as c,round2 as u,COMPUTE_INTERVAL as s}from"@any-touch/shared";function p(){let n=0,e=0;return function(o,r){const{prevVecotr:i,startVecotr:a,activeVecotr:c}=r;return c&&(e=Math.round(t(c,i)),n=Math.round(t(c,a))),{angle:n,deltaAngle:e}}}function d(){return function(t){const{prevInput:e}=t;let o=0,r=0,i=0;if(void 0!==e&&(o=t.x-e.x,r=t.y-e.y,0!==o||0!==r)){const t=Math.sqrt(Math.pow(o,2)+Math.pow(r,2));i=Math.round(n(Math.acos(Math.abs(o)/t)))}return{deltaX:o,deltaY:r,deltaXYAngle:i}}}function h(){let t,n=0,u=0,s=0,p=0,d=0;return function(h){const{phase:l,startInput:f}=h;return r===l?(n=0,u=0,s=0,p=0,d=0):i===l&&(n=Math.round(h.points[0][a]-f.points[0][a]),u=Math.round(h.points[0][c]-f.points[0][c]),s=Math.abs(n),p=Math.abs(u),d=Math.round(e({x:s,y:p})),t=o(n,u)),{displacementX:n,displacementY:u,distanceX:s,distanceY:p,distance:d,overallDirection:t}}}function l(){let t=1;return function(n,o){let r=1;const{prevVecotr:i,startVecotr:a,activeVecotr:c}=o;return c&&(r=u(e(c)/e(i)),t=u(e(c)/e(a))),{scale:t,deltaScale:r}}}function f(){let t,n,e=0,r=0,i=0,a=0;return function(c){if(void 0!==c){n=n||c.startInput;const u=c.timestamp-n.timestamp;if(s<u){const s=c.x-n.x,p=c.y-n.y;i=Math.round(s/u*100)/100,a=Math.round(p/u*100)/100,e=Math.abs(i),r=Math.abs(a),t=o(s,p),n=c}}return{velocityX:e,velocityY:r,speedX:i,speedY:a,direction:t}}}function M(){let t=0;return function(n){const{phase:e}=n;return r===e&&(t=n.pointLength),{maxPointLength:t}}}function v(t){return{x:t.points[1][a]-t.points[0][a],y:t.points[1][c]-t.points[0][c]}}function m(){let t,n,e;return function(o){const{prevInput:r,startMultiInput:i}=o;return void 0!==i&&void 0!==r&&o.id!==i.id&&1<r.pointLength&&1<o.pointLength?(t=v(i),n=v(r),e=v(o)):e=void 0,{startVecotr:t,prevVecotr:n,activeVecotr:e}}}export{p as ComputeAngle,d as ComputeDeltaXY,h as ComputeDistance,M as ComputeMaxLength,l as ComputeScale,f as ComputeVAndDir,m as ComputeVectorForMutli};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/compute/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/compute/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/compute/src/ComputeAngle.ts","../../../../packages/compute/src/ComputeDeltaXY.ts","../../../../packages/compute/src/ComputeDistance.ts","../../../../packages/compute/src/ComputeScale.ts","../../../../packages/compute/src/ComputeVAndDir.ts","../../../../packages/compute/src/ComputeMaxLength.ts","../../../../packages/compute/src/ComputeVectorForMutli.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["ComputeAngle","angle","deltaAngle","input","computed","prevVecotr","startVecotr","activeVecotr","Math","round","getAngle","prevInput","deltaX","deltaY","deltaXYAngle","x","y","deltaXY","sqrt","pow","radianToAngle","acos","abs","overallDirection","displacementX","displacementY","distanceX","distanceY","distance","phase","startInput","TYPE_START","TYPE_MOVE","points","CLIENT_X","CLIENT_Y","getVLength","getDirection","scale","deltaScale","round2","direction","lastValidInput","velocityX","velocityY","speedX","speedY","deltaTime","timestamp","COMPUTE_INTERVAL","ComputeMaxLength","maxPointLength","pointLength","computeVector","startMultiInput","id"],"mappings":"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"}
|
2
node_modules/@any-touch/compute/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/compute/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@any-touch/vector"),e=require("@any-touch/shared");function n(t){return{x:t.points[1][e.CLIENT_X]-t.points[0][e.CLIENT_X],y:t.points[1][e.CLIENT_Y]-t.points[0][e.CLIENT_Y]}}exports.ComputeAngle=function(){var e=0,n=0;return function(r,o){var a=o.prevVecotr,i=o.startVecotr,u=o.activeVecotr;return u&&(n=Math.round(t.getAngle(u,a)),e=Math.round(t.getAngle(u,i))),{angle:e,deltaAngle:n}}},exports.ComputeDeltaXY=function(){return function(e){var n=e.prevInput,r=0,o=0,a=0;if(void 0!==n&&(r=e.x-n.x,o=e.y-n.y,0!==r||0!==o)){var i=Math.sqrt(Math.pow(r,2)+Math.pow(o,2));a=Math.round(t.radianToAngle(Math.acos(Math.abs(r)/i)))}return{deltaX:r,deltaY:o,deltaXYAngle:a}}},exports.ComputeDistance=function(){var n,r=0,o=0,a=0,i=0,u=0;return function(c){var p=c.phase,s=c.startInput;return e.TYPE_START===p?(r=0,o=0,a=0,i=0,u=0):e.TYPE_MOVE===p&&(r=Math.round(c.points[0][e.CLIENT_X]-s.points[0][e.CLIENT_X]),o=Math.round(c.points[0][e.CLIENT_Y]-s.points[0][e.CLIENT_Y]),a=Math.abs(r),i=Math.abs(o),u=Math.round(t.getVLength({x:a,y:i})),n=t.getDirection(r,o)),{displacementX:r,displacementY:o,distanceX:a,distanceY:i,distance:u,overallDirection:n}}},exports.ComputeMaxLength=function(){var t=0;return function(n){var r=n.phase;return e.TYPE_START===r&&(t=n.pointLength),{maxPointLength:t}}},exports.ComputeScale=function(){var n=1;return function(r,o){var a=1,i=o.prevVecotr,u=o.startVecotr,c=o.activeVecotr;return c&&(a=e.round2(t.getVLength(c)/t.getVLength(i)),n=e.round2(t.getVLength(c)/t.getVLength(u))),{scale:n,deltaScale:a}}},exports.ComputeVAndDir=function(){var n,r,o=0,a=0,i=0,u=0;return function(c){if(void 0!==c){r=r||c.startInput;var p=c.timestamp-r.timestamp;if(e.COMPUTE_INTERVAL<p){var s=c.x-r.x,d=c.y-r.y;i=Math.round(s/p*100)/100,u=Math.round(d/p*100)/100,o=Math.abs(i),a=Math.abs(u),n=t.getDirection(s,d),r=c}}return{velocityX:o,velocityY:a,speedX:i,speedY:u,direction:n}}},exports.ComputeVectorForMutli=function(){var t,e,r;return function(o){var a=o.prevInput,i=o.startMultiInput;return void 0!==i&&void 0!==a&&o.id!==i.id&&1<a.pointLength&&1<o.pointLength?(t=n(i),e=n(a),r=n(o)):r=void 0,{startVecotr:t,prevVecotr:e,activeVecotr:r}}};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/compute/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/compute/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/compute/src/ComputeVectorForMutli.ts","../../../../packages/compute/src/ComputeAngle.ts","../../../../packages/compute/src/ComputeDeltaXY.ts","../../../../packages/compute/src/ComputeDistance.ts","../../../../packages/compute/src/ComputeMaxLength.ts","../../../../packages/compute/src/ComputeScale.ts","../../../../packages/compute/src/ComputeVAndDir.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["computeVector","input","x","points","CLIENT_X","y","CLIENT_Y","angle","deltaAngle","computed","prevVecotr","startVecotr","activeVecotr","Math","round","getAngle","prevInput","deltaX","deltaY","deltaXYAngle","deltaXY","sqrt","pow","radianToAngle","acos","abs","overallDirection","displacementX","displacementY","distanceX","distanceY","distance","phase","startInput","TYPE_START","TYPE_MOVE","getVLength","getDirection","maxPointLength","pointLength","scale","deltaScale","round2","direction","lastValidInput","velocityX","velocityY","speedX","speedY","deltaTime","timestamp","COMPUTE_INTERVAL","startMultiInput","id"],"mappings":"sIAEA,SAASA,EAAcC,GACnB,MAAO,CACHC,EAAGD,EAAME,OAAO,GAAGC,YAAYH,EAAME,OAAO,GAAGC,YAC/CC,EAAGJ,EAAME,OAAO,GAAGG,YAAYL,EAAME,OAAO,GAAGG,6CCInD,IAAIC,EAAQ,EACRC,EAAa,EACjB,OAAO,SAAUP,EAAcQ,GACnB,IAAAC,EAA0CD,aAA9BE,EAA8BF,cAAjBG,EAAiBH,eAKlD,OAJIG,IACAJ,EAAaK,KAAKC,MAAMC,WAASH,EAAcF,IAC/CH,EAAQM,KAAKC,MAAMC,WAASH,EAAcD,KAEvC,CAAEJ,QAAOC,kDCbpB,OAAO,SAAUP,GACL,IAAAe,EAAcf,YAClBgB,EAAS,EACTC,EAAS,EAETC,EAAe,EAGnB,QAAI,IAAWH,IACXC,EAAShB,EAAMC,EAAIc,EAAUd,EAC7BgB,EAASjB,EAAMI,EAAIW,EAAUX,EAGzB,IAAMY,GAAU,IAAMC,GAAQ,CAC9B,IAAME,EAAUP,KAAKQ,KAAKR,KAAKS,IAAIL,EAAQ,GAAKJ,KAAKS,IAAIJ,EAAQ,IACjEC,EAAeN,KAAKC,MAAMS,gBAAcV,KAAKW,KAAKX,KAAKY,IAAIR,GAAUG,KAG7E,MAAO,CAAEH,SAAQC,SAAQC,qDChB7B,IAKIO,EALAC,EAAgB,EAChBC,EAAgB,EAChBC,EAAY,EACZC,EAAY,EACZC,EAAW,EAGf,OAAO,SAAU9B,GACL,IAAA+B,EAAsB/B,QAAfgC,EAAehC,aAkB9B,OAhBIiC,eAAeF,GACfL,EAAgB,EAChBC,EAAgB,EAChBC,EAAY,EACZC,EAAY,EACZC,EAAW,GAGNI,cAAcH,IACnBL,EAAgBd,KAAKC,MAAMb,EAAME,OAAO,GAAGC,YAAY6B,EAAW9B,OAAO,GAAGC,aAC5EwB,EAAgBf,KAAKC,MAAMb,EAAME,OAAO,GAAGG,YAAY2B,EAAW9B,OAAO,GAAGG,aAC5EuB,EAAYhB,KAAKY,IAAIE,GACrBG,EAAYjB,KAAKY,IAAIG,GACrBG,EAAWlB,KAAKC,MAAMsB,aAAW,CAAElC,EAAG2B,EAAWxB,EAAGyB,KACpDJ,EAAmBW,eAAaV,EAAeC,IAE5C,CACHD,gBAAeC,gBAAeC,YAAWC,YAAWC,WAAUL,+CC9B1E,WACI,IAAIY,EAAiB,EACrB,OAAO,SAAUrC,GACL,IAAA+B,EAAU/B,QAIlB,OAHIiC,eAAeF,IACfM,EAAiBrC,EAAMsC,aAEpB,CAAED,oDCLb,IAAIE,EAAQ,EACZ,OAAO,SACHvC,EAAcQ,GAEd,IAAIgC,EAAa,EACT/B,EAA0CD,aAA9BE,EAA8BF,cAAjBG,EAAiBH,eAKlD,OAJIG,IACA6B,EAAaC,SAAON,aAAWxB,GAAgBwB,aAAW1B,IAC1D8B,EAAQE,SAAON,aAAWxB,GAAgBwB,aAAWzB,KAElD,CAAE6B,QAAOC,kDCNpB,IAIIE,EAEAC,EANAC,EAAY,EACZC,EAAY,EACZC,EAAS,EACTC,EAAS,EASb,OAAO,SAAU/C,GAEb,QAAI,IAAWA,EAAO,CAElB2C,EAAiBA,GAAkB3C,EAAMgC,WACzC,IAAMgB,EAAYhD,EAAMiD,UAAYN,EAAeM,UAEnD,GAAIC,mBAAmBF,EAAW,CAC9B,IAAMhC,EAAShB,EAAMC,EAAI0C,EAAe1C,EAClCgB,EAASjB,EAAMI,EAAIuC,EAAevC,EACxC0C,EAASlC,KAAKC,MAAMG,EAASgC,EAAY,KAAO,IAChDD,EAASnC,KAAKC,MAAMI,EAAS+B,EAAY,KAAO,IAChDJ,EAAYhC,KAAKY,IAAIsB,GACrBD,EAAYjC,KAAKY,IAAIuB,GACrBL,EAAYN,eAAapB,EAAQC,GAEjC0B,EAAiB3C,GAKzB,MAAO,CAAE4C,YAAWC,YAAWC,SAAQC,SAAQL,wDN3BnD,IAAIhC,EACAD,EACAE,EAEJ,OAAO,SAAUX,GACL,IAAAe,EAA+Bf,YAApBmD,EAAoBnD,kBAcvC,YAbI,IAAWmD,QACX,IAAWpC,GACXf,EAAMoD,KAAOD,EAAgBC,IAC7B,EAAIrC,EAAUuB,aACd,EAAItC,EAAMsC,aAEV5B,EAAcX,EAAcoD,GAC5B1C,EAAaV,EAAcgB,GAC3BJ,EAAeZ,EAAcC,IAE7BW,OAAe,EAGZ,CACHD,cACAD,aACAE"}
|
22
node_modules/@any-touch/compute/package.json
generated
vendored
Normal file
22
node_modules/@any-touch/compute/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@any-touch/compute",
|
||||
"version": "2.2.0",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
"description": "any-touch内部依赖的包, 进行手势数据计算.",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"@any-touch/vector": "^2.2.0",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/core/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/core/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
16
node_modules/@any-touch/core/README.md
generated
vendored
Normal file
16
node_modules/@any-touch/core/README.md
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# @any-touch/core
|
||||
🤖核心组件, 主要用来把Mouse/Touch输入变成统一的输出, 实现PC/Mobile端的兼容, 提供了"**at:**"开头的兼容事件.
|
||||
|
||||
```javascript
|
||||
import Core from '@any-touch/core';
|
||||
const at = new Core(el);
|
||||
// 兼容Mouse/Touch
|
||||
at.on('at', (ev) => {
|
||||
// ev包含位置/时间/事件对象等属性.
|
||||
});
|
||||
// start / move / end / cancel
|
||||
at.on('at:start', onStart);
|
||||
at.on('at:move', onMove);
|
||||
at.on('at:end', onEnd);
|
||||
at.on('at:cancel', onCancel);
|
||||
```
|
3
node_modules/@any-touch/core/dist/bindElement.d.ts
generated
vendored
Normal file
3
node_modules/@any-touch/core/dist/bindElement.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import type { SupportElement } from 'any-touch';
|
||||
import type { NativeEvent } from '@any-touch/shared';
|
||||
export default function (el: SupportElement, catchEvent: (e: NativeEvent) => void, options?: boolean | AddEventListenerOptions): () => void;
|
9
node_modules/@any-touch/core/dist/canPreventDefault.d.ts
generated
vendored
Normal file
9
node_modules/@any-touch/core/dist/canPreventDefault.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import type { NativeEvent } from '@any-touch/shared';
|
||||
import { Options } from './index';
|
||||
/**
|
||||
* 计算是否需要阻止默认事件
|
||||
* @param event touch/mouse事件对象
|
||||
* @param options anytouch的选项
|
||||
* @returns 是否阻止默认事件
|
||||
*/
|
||||
export default function (event: NativeEvent, options: Options): boolean;
|
17
node_modules/@any-touch/core/dist/const.d.ts
generated
vendored
Normal file
17
node_modules/@any-touch/core/dist/const.d.ts
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
export declare const TOUCH_START = "touchstart";
|
||||
export declare const TOUCH_MOVE = "touchmove";
|
||||
export declare const TOUCH_END = "touchend";
|
||||
export declare const TOUCH_CANCEL = "touchcancel";
|
||||
export declare const MOUSE_UP = "mouseup";
|
||||
export declare const MOUSE_MOVE = "mousemove";
|
||||
export declare const MOUSE_DOWN = "mousedown";
|
||||
export declare const CLIENT_X = "clientX";
|
||||
export declare const CLIENT_Y = "clientY";
|
||||
/**
|
||||
* 输入阶段
|
||||
*/
|
||||
export declare const TYPE_START = "start";
|
||||
export declare const TYPE_MOVE = "move";
|
||||
export declare const TYPE_CANCEL = "cancel";
|
||||
export declare const TYPE_END = "end";
|
||||
export declare function isFunction(input: any): input is Function;
|
2
node_modules/@any-touch/core/dist/createInput/index.d.ts
generated
vendored
Normal file
2
node_modules/@any-touch/core/dist/createInput/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export { default as mouse } from './mouse';
|
||||
export { default as touch } from './touch';
|
6
node_modules/@any-touch/core/dist/createInput/inputCreator.d.ts
generated
vendored
Normal file
6
node_modules/@any-touch/core/dist/createInput/inputCreator.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* event(Mouse|Touch) => BasicsInput => Input => Computed => AnyTouchEvent
|
||||
* 构造统一的Input格式
|
||||
*/
|
||||
import type { PubicEvent, Input } from '@any-touch/shared';
|
||||
export default function (): (basicsInput: PubicEvent) => Input | void;
|
1
node_modules/@any-touch/core/dist/createInput/mouse.d.ts
generated
vendored
Normal file
1
node_modules/@any-touch/core/dist/createInput/mouse.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default function (): (event: MouseEvent) => void | import("@any-touch/shared").Input;
|
4
node_modules/@any-touch/core/dist/createInput/touch.d.ts
generated
vendored
Normal file
4
node_modules/@any-touch/core/dist/createInput/touch.d.ts
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 格式化Touch事件对象
|
||||
*/
|
||||
export default function (el?: Element): (event: TouchEvent) => void | import("@any-touch/shared").Input;
|
5
node_modules/@any-touch/core/dist/dispatchDomEvent.d.ts
generated
vendored
Normal file
5
node_modules/@any-touch/core/dist/dispatchDomEvent.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { AnyTouchEvent } from '@any-touch/shared';
|
||||
/**
|
||||
* 触发dom事件
|
||||
*/
|
||||
export default function (typeName: string, el: EventTarget, payload: Partial<AnyTouchEvent>, eventInit?: EventInit): boolean | void;
|
119
node_modules/@any-touch/core/dist/index.d.ts
generated
vendored
Normal file
119
node_modules/@any-touch/core/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
/**
|
||||
* 主程序, 不包含手势,
|
||||
* 主要用来适配Mouse/Touch事件
|
||||
* ==================== 参考 ====================
|
||||
* https://segmentfault.com/a/1190000010511484#articleHeader0
|
||||
* https://segmentfault.com/a/1190000007448808#articleHeader1
|
||||
* hammer.js http://hammerjs.github.io/
|
||||
* ==================== 流程 ====================
|
||||
* Event(Mouse|Touch) => BaseInput => Input => Computed => AnyTouchEvent
|
||||
*/
|
||||
import AnyEvent from 'any-event';
|
||||
import type { SupportElement } from 'any-touch';
|
||||
import type { UnionToIntersection, Computed, NativeEvent, ComputeFunctionCreator, PluginContext, Plugin, Input } from '@any-touch/shared';
|
||||
export { AnyTouchEvent } from '@any-touch/shared';
|
||||
export interface Options {
|
||||
domEvents?: false | EventInit;
|
||||
preventDefault?: boolean | ((e: NativeEvent) => boolean);
|
||||
}
|
||||
declare type GetPluginContext<N> = N extends keyof PluginContextMap ? PluginContextMap[N] : (PluginContext | undefined);
|
||||
/**
|
||||
* 默认的事件名和事件对象映射
|
||||
*/
|
||||
export interface EventMap {
|
||||
input: Input;
|
||||
computed: Record<string, any>;
|
||||
u: undefined;
|
||||
'at:after': Computed;
|
||||
'at:start': Input;
|
||||
'at:move': Input;
|
||||
'at:cancel': Input;
|
||||
'at:end': Input;
|
||||
}
|
||||
/**
|
||||
* 插件映射
|
||||
* {名称: 插件实例}
|
||||
* @example
|
||||
* {tap:TapContext}
|
||||
*/
|
||||
export interface PluginContextMap {
|
||||
}
|
||||
/**
|
||||
* 手势库的核心,
|
||||
* 本身不具备手势识别,
|
||||
* 需要加载识别器插件.
|
||||
* @example
|
||||
* import Core from '@any-touch/core';
|
||||
* import pan from '@any-touch/pan';
|
||||
* const at = new Core();
|
||||
* at.use(pan);
|
||||
*/
|
||||
export default class extends AnyEvent<EventMap> {
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
v: string;
|
||||
/**
|
||||
* 当前绑定元素
|
||||
*/
|
||||
el?: SupportElement;
|
||||
/**
|
||||
* 当前插件(仅供插件开发者使用)
|
||||
*/
|
||||
c?: PluginContext;
|
||||
private __options;
|
||||
private __inputCreatorMap;
|
||||
private __computeFunctionList;
|
||||
private __computeFunctionCreatorList;
|
||||
private __pluginContexts;
|
||||
private __isIgnoreMouse;
|
||||
/**
|
||||
* @param el 目标元素, 微信下没有el
|
||||
* @param options 选项
|
||||
*/
|
||||
constructor(el?: SupportElement, options?: Options);
|
||||
/**
|
||||
* 加载并初始化插件
|
||||
* @param plugin 插件
|
||||
* @param pluginOptions 插件选项
|
||||
*/
|
||||
use<P extends Plugin>(plugin: P, pluginOptions?: Parameters<P>[1]): void;
|
||||
/**
|
||||
* 监听input变化
|
||||
* @param event Touch / Mouse事件对象
|
||||
*/
|
||||
catchEvent(event: NativeEvent): void;
|
||||
/**
|
||||
* 缓存计算函数生成器到队列
|
||||
* @param computeFunctionCreatorList 一组计算函数生成器
|
||||
*/
|
||||
compute<CList extends ComputeFunctionCreator[] = ComputeFunctionCreator[]>(computeFunctionCreatorList: CList, callback: (computed: UnionToIntersection<ReturnType<ReturnType<CList[0]>>> & Input) => void): void;
|
||||
/**
|
||||
* 拦截器
|
||||
* 可以控制事件的触发
|
||||
* @param interceptor 拦截函数
|
||||
*/
|
||||
beforeEach(interceptor: (type: string, next: () => void) => void): void;
|
||||
/**
|
||||
* 获取识别器通过名字
|
||||
* @param name 识别器的名字
|
||||
* @return 返回识别器
|
||||
*/
|
||||
get<N extends keyof PluginContextMap>(name: N): GetPluginContext<N>;
|
||||
/**
|
||||
* 设置选项
|
||||
* @param newOptions 选项
|
||||
*/
|
||||
set(newOptions: Partial<Options>): void;
|
||||
/**
|
||||
* 带DOM事件的emit(仅供插件开发者使用)
|
||||
* @param type 事件类型
|
||||
* @param payload 数据
|
||||
* @param pluginContext 插件实例
|
||||
*/
|
||||
emit2(type: string, payload: Computed, pluginContext: PluginContext): void;
|
||||
/**
|
||||
* 销毁
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
2
node_modules/@any-touch/core/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/core/dist/index.es.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@any-touch/core/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/core/dist/index.es.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/@any-touch/core/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/core/dist/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@any-touch/core/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/core/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
37
node_modules/@any-touch/core/package.json
generated
vendored
Normal file
37
node_modules/@any-touch/core/package.json
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@any-touch/core",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch核心程序, 主要用来兼容Mouse/Touch事件.",
|
||||
"unpkg": "dist/any-touch.js",
|
||||
"jsdelivr": "dist/any-touch.js",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/any86/any-touch.git"
|
||||
},
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/any86/any-touch/issues"
|
||||
},
|
||||
"homepage": "https://github.com/any86/any-touch#readme",
|
||||
"dependencies": {
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"any-event": "^2.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"touch",
|
||||
"mouse",
|
||||
"gesture"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/doubletap/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/doubletap/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
84
node_modules/@any-touch/doubletap/README.md
generated
vendored
Normal file
84
node_modules/@any-touch/doubletap/README.md
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
# @any-touch/doubletap
|
||||
**双击**识别器. 基于[@any-touch/tap](https://github.com/any86/any-touch/tree/master/packages/tap)实现, 是tap的一个特例.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/doubletap
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载tap识别器(拖拽)
|
||||
import Core from '@any-touch/core';
|
||||
import doubletap from '@any-touch/doubletap';
|
||||
const at = new Core(el);
|
||||
at.use(doubletap)
|
||||
|
||||
// 双击
|
||||
at.on('doubletap', (event) => {
|
||||
console.log(event) // 包含点击位置信息
|
||||
});
|
||||
```
|
||||
|
||||
## 源码解析
|
||||
因为是基于[@any-touch/tap](https://github.com/any86/any-touch/tree/master/packages/tap)实现的, 所以代码不多, 只是使用[beforeEach拦截器](https://github.com/any86/any-touch/blob/master/docs/API.md#beforeeachhook).
|
||||
```typescript
|
||||
export default function (at: Core) {
|
||||
at.use(tap, { name: 'doubletap', tapTimes: 2 });
|
||||
const doubleTapContext = at.get('doubletap')
|
||||
let timeID: number;
|
||||
at.beforeEach((type, next) => {
|
||||
if ('tap' === type) {
|
||||
clearTimeout(timeID);
|
||||
timeID = setTimeout(() => {
|
||||
if ([STATE.POSSIBLE, STATE.FAILED].includes(doubleTapContext.state)) {
|
||||
next();
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
return doubleTapContext;
|
||||
}
|
||||
```
|
||||
|
||||
这里只需要多理解一个概念就是STATE(识别器的状态).
|
||||
|名称|解释|
|
||||
|---|---|
|
||||
|POSSIBLE|待识别|
|
||||
|RECOGNIZED|已识别|
|
||||
|FAILED|识别失败|
|
||||
|
||||
|
||||
识别流程如下, 每次点击屏幕, STATE是"**POSSIBLE**状态, 识别成功后状态变成"**RECOGNIZED**", 识别失败变成"**FAILED**".
|
||||
|
||||
特别解释下"**FAILED**"的发生情况,用doubletap识别器举例, 当2次点击间隔时间过长, doubletap的状态就会变成"**FAILED**", 当第三次点击的时候状态又变回"**POSSIBLE**".
|
||||
|
||||
[完整源码](https://github.com/any86/any-touch/blob/master/packages/doubletap/src/index.ts)
|
||||
|
||||
## N击
|
||||
如果看懂了双击的逻辑, 那么稍作修改就可以实现"3击".
|
||||
```typescript
|
||||
export default function (at: Core) {
|
||||
// ⭐只有这一行的tapTimes改成了3
|
||||
at.use(tap, { name: 'doubletap', tapTimes: 3 });
|
||||
|
||||
// 未改动
|
||||
const doubleTapContext = at.get('doubletap')
|
||||
let timeID: number;
|
||||
at.beforeEach((type, next) => {
|
||||
if ('tap' === type) {
|
||||
clearTimeout(timeID);
|
||||
timeID = setTimeout(() => {
|
||||
if ([STATE.POSSIBLE, STATE.FAILED].includes(doubleTapContext.state)) {
|
||||
next();
|
||||
}
|
||||
}, 300);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
return doubleTapContext;
|
||||
}
|
||||
```
|
21
node_modules/@any-touch/doubletap/dist/index.d.ts
generated
vendored
Normal file
21
node_modules/@any-touch/doubletap/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import Core from '@any-touch/core';
|
||||
import { TapContext } from '@any-touch/tap';
|
||||
import type { AnyTouchEvent } from '@any-touch/shared';
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
doubletap: TapContext;
|
||||
}
|
||||
interface EventMap {
|
||||
doubletap: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "拖拽"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options 识别器选项
|
||||
* @returns 识别器实例
|
||||
*/
|
||||
export default function (at: Core): any;
|
2
node_modules/@any-touch/doubletap/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/doubletap/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import t from"@any-touch/tap";function e(e){e.use(t,{name:"doubletap",tapTimes:2});const a=e.get("doubletap");let o;return e.beforeEach(((t,e)=>{"tap"===t?(clearTimeout(o),o=setTimeout((()=>{[0,2].includes(a.state)&&e()}),300)):e()})),a}export{e as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/doubletap/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/doubletap/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/doubletap/src/index.ts"],"sourcesContent":[null],"names":["at","use","tap","name","tapTimes","doubleTapContext","get","timeID","beforeEach","type","next","clearTimeout","setTimeout","includes","state"],"mappings":"yCA0ByBA,GACrBA,EAAGC,IAAIC,EAAK,CAAEC,KAAM,YAAaC,SAAU,IAC3C,MAAMC,EAAmBL,EAAGM,IAAI,aAChC,IAAIC,EAaJ,OAZAP,EAAGQ,YAAW,CAACC,EAAMC,KACb,QAAUD,GACVE,aAAaJ,GACbA,EAAUK,YAAoC,KACtC,MAA+BC,SAASR,EAAiBS,QACzDJ,MAEL,MAEHA,OAGDL"}
|
2
node_modules/@any-touch/doubletap/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/doubletap/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@any-touch/tap"));exports.default=function(e){e.use(t.default,{name:"doubletap",tapTimes:2});var u,a=e.get("doubletap");return e.beforeEach((function(e,t){"tap"===e?(clearTimeout(u),u=setTimeout((function(){[0,2].includes(a.state)&&t()}),300)):t()})),a};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/doubletap/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/doubletap/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/doubletap/src/index.ts"],"sourcesContent":[null],"names":["at","use","tap","name","tapTimes","timeID","doubleTapContext","get","beforeEach","type","next","clearTimeout","setTimeout","includes","state"],"mappings":"wMA0ByBA,GACrBA,EAAGC,IAAIC,UAAK,CAAEC,KAAM,YAAaC,SAAU,IAC3C,IACIC,EADEC,EAAmBN,EAAGO,IAAI,aAchC,OAZAP,EAAGQ,YAAW,SAACC,EAAMC,GACb,QAAUD,GACVE,aAAaN,GACbA,EAAUO,YAAoC,WACtC,MAA+BC,SAASP,EAAiBQ,QACzDJ,MAEL,MAEHA,OAGDJ"}
|
23
node_modules/@any-touch/doubletap/package.json
generated
vendored
Normal file
23
node_modules/@any-touch/doubletap/package.json
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@any-touch/doubletap",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别双击手势, 是Tap识别器的一个特例",
|
||||
"main": "./dist/index",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"@any-touch/vector": "^2.2.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/pan/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/pan/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
28
node_modules/@any-touch/pan/README.md
generated
vendored
Normal file
28
node_modules/@any-touch/pan/README.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# @any-touch/pan
|
||||
**拖拽**识别器.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/pan
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载pan识别器(拖拽)
|
||||
import Core from '@any-touch/core';
|
||||
import pan from '@any-touch/pan';
|
||||
const at = new Core(el);
|
||||
at.use(pan, 参数)
|
||||
|
||||
// 拖拽
|
||||
at.on('pan', (event) => {
|
||||
// event包含位置/速度/方向等信息
|
||||
});
|
||||
```
|
||||
|
||||
## 参数
|
||||
|名称|数据类型|默认值|说明|
|
||||
|---|---|---|---|
|
||||
|name|`String`|'pan'|自定义事件名称|
|
||||
|pointLength|`Number`|1|支持的触点数, 可支持多指拖拽|
|
||||
|threshold| `Number`|10|拖拽超过10px后触发pan事件|
|
38
node_modules/@any-touch/pan/dist/index.d.ts
generated
vendored
Normal file
38
node_modules/@any-touch/pan/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
|
||||
import Core from '@any-touch/core';
|
||||
declare const DEFAULT_OPTIONS: {
|
||||
name: string;
|
||||
threshold: number;
|
||||
pointLength: number;
|
||||
};
|
||||
/**
|
||||
* 实例
|
||||
*/
|
||||
export declare type PanContext = PluginContext & typeof DEFAULT_OPTIONS;
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
pan: PanContext;
|
||||
}
|
||||
interface EventMap {
|
||||
pan: AnyTouchEvent;
|
||||
panstart: AnyTouchEvent;
|
||||
panmove: AnyTouchEvent;
|
||||
panend: AnyTouchEvent;
|
||||
pancancel: AnyTouchEvent;
|
||||
panup: AnyTouchEvent;
|
||||
pandown: AnyTouchEvent;
|
||||
panright: AnyTouchEvent;
|
||||
panleft: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "拖拽"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options 识别器选项
|
||||
* @returns 识别器实例
|
||||
*/
|
||||
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): PanContext;
|
||||
export {};
|
2
node_modules/@any-touch/pan/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/pan/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{createPluginContext as t,resetState as e,isDisabled as n,flow as o,isMoveOrEndOrCancel as i,getStatusName as s,TYPE_END as r,TYPE_CANCEL as a}from"@any-touch/shared";import{ComputeVAndDir as c,ComputeDistance as h,ComputeDeltaXY as m}from"@any-touch/compute";const p={name:"pan",threshold:10,pointLength:1};function u(u,d){const f=t(p,d);return u.compute([c,h,m],(t=>{if(e(f),n(f))return;const c=function(){const{pointLength:e,distance:n}=t;return f.pointLength===e&&f.threshold<=n}();if(f.state=o(c,f.state,t.phase),c||i(f.state)){const{name:e}=f;u.emit2(e,t,f),u.emit2(e+s(f.state),t,f),![r,a].includes(t.phase)&&t.direction&&u.emit2(e+t.direction,t,f)}})),f}export{u as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/pan/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/pan/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/pan/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","pointLength","at","options","context","createPluginContext","compute","ComputeVAndDir","ComputeDistance","ComputeDeltaXY","computed","resetState","isDisabled","isValid","distance","test","state","flow","phase","isMoveOrEndOrCancel","emit2","getStatusName","TYPE_END","TYPE_CANCEL","includes","direction"],"mappings":"0QASA,MAAMA,EAAkB,CAAEC,KAAM,MAAOC,UAAW,GAAIC,YAAa,cAkC1CC,EAAUC,GAC/B,MAAMC,EAAUC,EAAoBP,EAAiBK,GAyBrD,OAtBAD,EAAGI,QAAQ,CAACC,EAAgBC,EAAiBC,IAAiBC,IAI1D,GAFAC,EAAWP,GAEPQ,EAAWR,GAAU,OACzB,MAAMS,EAYN,WACI,MAAMZ,YAAEA,EAAWa,SAAEA,GAAaJ,EAClC,OAAON,EAAQH,cAAgBA,GAAeG,EAAQJ,WAAac,EAdvDC,GAEhB,GADAX,EAAQY,MAAQC,EAAKJ,EAAST,EAAQY,MAAON,EAASQ,OAClDL,GAAWM,EAAoBf,EAAQY,OAAQ,CAC/C,MAAMjB,KAAEA,GAASK,EACjBF,EAAGkB,MAAMrB,EAAMW,EAAUN,GACzBF,EAAGkB,MAAMrB,EAAOsB,EAAcjB,EAAQY,OAAQN,EAAUN,IACnD,CAACkB,EAAUC,GAAaC,SAASd,EAASQ,QAAUR,EAASe,WAC9DvB,EAAGkB,MAAMrB,EAAOW,EAASe,UAAWf,EAAUN,OAUnDA"}
|
2
node_modules/@any-touch/pan/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/pan/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@any-touch/shared"),t=require("@any-touch/compute"),a={name:"pan",threshold:10,pointLength:1};exports.default=function(n,i){var r=e.createPluginContext(a,i);return n.compute([t.ComputeVAndDir,t.ComputeDistance,t.ComputeDeltaXY],(function(t){if(e.resetState(r),!e.isDisabled(r)){var a,i,o=(a=t.pointLength,i=t.distance,r.pointLength===a&&r.threshold<=i);if(r.state=e.flow(o,r.state,t.phase),o||e.isMoveOrEndOrCancel(r.state)){var s=r.name;n.emit2(s,t,r),n.emit2(s+e.getStatusName(r.state),t,r),![e.TYPE_END,e.TYPE_CANCEL].includes(t.phase)&&t.direction&&n.emit2(s+t.direction,t,r)}}})),r};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/pan/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/pan/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/pan/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","pointLength","at","options","context","createPluginContext","compute","ComputeVAndDir","ComputeDistance","ComputeDeltaXY","computed","resetState","isDisabled","distance","isValid","state","flow","phase","isMoveOrEndOrCancel","name_1","emit2","getStatusName","TYPE_END","TYPE_CANCEL","includes","direction"],"mappings":"uIASMA,EAAkB,CAAEC,KAAM,MAAOC,UAAW,GAAIC,YAAa,4BAkC1CC,EAAUC,GAC/B,IAAMC,EAAUC,sBAAoBP,EAAiBK,GAyBrD,OAtBAD,EAAGI,QAAQ,CAACC,iBAAgBC,kBAAiBC,mBAAiB,SAAAC,GAI1D,GAFAC,aAAWP,IAEPQ,aAAWR,GAAf,CACA,IAaYH,EAAaY,EAbnBC,GAaMb,EAA0BS,cAAbG,EAAaH,WAC3BN,EAAQH,cAAgBA,GAAeG,EAAQJ,WAAaa,GAZvE,GADAT,EAAQW,MAAQC,OAAKF,EAASV,EAAQW,MAAOL,EAASO,OAClDH,GAAWI,sBAAoBd,EAAQW,OAAQ,CACvC,IAAAI,EAASf,OACjBF,EAAGkB,MAAMD,EAAMT,EAAUN,GACzBF,EAAGkB,MAAMD,EAAOE,gBAAcjB,EAAQW,OAAQL,EAAUN,IACnD,CAACkB,WAAUC,eAAaC,SAASd,EAASO,QAAUP,EAASe,WAC9DvB,EAAGkB,MAAMD,EAAOT,EAASe,UAAWf,EAAUN,QAUnDA"}
|
22
node_modules/@any-touch/pan/package.json
generated
vendored
Normal file
22
node_modules/@any-touch/pan/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@any-touch/pan",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别拖拽手势.",
|
||||
"main": "./dist/index",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/pinch/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/pinch/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
28
node_modules/@any-touch/pinch/README.md
generated
vendored
Normal file
28
node_modules/@any-touch/pinch/README.md
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
# @any-touch/pinch
|
||||
**缩放**识别器.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/pinch
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载pinch识别器(拖拽)
|
||||
import Core from '@any-touch/core';
|
||||
import pinch from '@any-touch/pinch';
|
||||
const at = new Core(el);
|
||||
at.use(pinch, 参数)
|
||||
|
||||
// 缩放
|
||||
at.on('pinch', (event) => {
|
||||
// event包含位置/速度/方向等信息
|
||||
});
|
||||
```
|
||||
|
||||
## 参数
|
||||
|名称|数据类型|默认值|说明|
|
||||
|---|---|---|---|
|
||||
|name|`String`|'pinch'|自定义事件名称|
|
||||
|pointLength|`Number`|2|支持的触点数, 可支持多指拖拽|
|
||||
|threshold| `Number`|0|缩放超过0倍才触发pinch事件|
|
39
node_modules/@any-touch/pinch/dist/index.d.ts
generated
vendored
Normal file
39
node_modules/@any-touch/pinch/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
|
||||
import Core from '@any-touch/core';
|
||||
/**
|
||||
* 默认选项
|
||||
*/
|
||||
declare const DEFAULT_OPTIONS: {
|
||||
name: string;
|
||||
threshold: number;
|
||||
pointLength: number;
|
||||
};
|
||||
/**
|
||||
* 实例
|
||||
*/
|
||||
declare type PinchContext = PluginContext & typeof DEFAULT_OPTIONS;
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
pinch: PinchContext;
|
||||
}
|
||||
interface EventMap {
|
||||
pinch: AnyTouchEvent;
|
||||
pinchstart: AnyTouchEvent;
|
||||
pinchmove: AnyTouchEvent;
|
||||
pinchend: AnyTouchEvent;
|
||||
pinchcancel: AnyTouchEvent;
|
||||
pinchin: AnyTouchEvent;
|
||||
pinchout: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "啮合"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options 识别器选项
|
||||
* @returns
|
||||
*/
|
||||
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): PinchContext;
|
||||
export {};
|
2
node_modules/@any-touch/pinch/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/pinch/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{createPluginContext as t,resetState as e,isDisabled as n,flow as o,isMoveOrEndOrCancel as a,getStatusName as s}from"@any-touch/shared";import{ComputeVectorForMutli as c,ComputeScale as h}from"@any-touch/compute";const i={name:"pinch",threshold:0,pointLength:2};function r(r,m){const p=t(i,m);return r.compute([c,h],(t=>{if(e(p),n(p))return;const c=function(){const{pointLength:e,scale:n,deltaScale:o,phase:a}=t;return p.pointLength===e&&p.threshold<Math.abs(n-1)}();p.state=o(c,p.state,t.phase);const{name:h}=p;if(c||a(p.state)){r.emit2(h,t,p);const{deltaScale:e}=t;1!==e&&r.emit2(h+(1<e?"in":"out"),t,p)}const i=s(p.state);i&&r.emit2(h+i,t,p)})),p}export{r as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/pinch/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/pinch/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/pinch/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","pointLength","at","options","context","createPluginContext","compute","ComputeVectorForMutli","ComputeScale","computed","resetState","isDisabled","isValid","scale","deltaScale","phase","Math","abs","test","state","flow","isMoveOrEndOrCancel","emit2","stateName","getStatusName"],"mappings":"2NAeA,MAAMA,EAAkB,CACpBC,KAAM,QAENC,UAAW,EACXC,YAAa,cAiCQC,EAAUC,GAC/B,MAAMC,EAAUC,EAAoBP,EAAiBK,GAyCrD,OAvCAD,EAAGI,QAAQ,CAACC,EAAuBC,IAAgBC,IAK/C,GAHAC,EAAWN,GAGPO,EAAWP,GAAU,OACzB,MAAMQ,EAqBN,WAEI,MAAMX,YAAEA,EAAWY,MAAEA,EAAKC,WAAEA,EAAUC,MAAEA,GAAUN,EAClD,OACIL,EAAQH,cAAgBA,GAGxBG,EAAQJ,UAAYgB,KAAKC,IAAIJ,EAAQ,GA5B7BK,GAEhBd,EAAQe,MAAQC,EAAKR,EAASR,EAAQe,MAAOV,EAASM,OAGtD,MAAMhB,KAAEA,GAASK,EACjB,GAAIQ,GAAWS,EAAoBjB,EAAQe,OAAQ,CAC/CjB,EAAGoB,MAAMvB,EAAMU,EAAUL,GAEzB,MAAMU,WAAEA,GAAeL,EACnB,IAAMK,GACNZ,EAAGoB,MAAMvB,GAAQ,EAAIe,EAAa,KAAO,OAAQL,EAAUL,GAInE,MAAMmB,EAAYC,EAAcpB,EAAQe,OACpCI,GACArB,EAAGoB,MAAMvB,EAAOwB,EAAWd,EAAUL,MAgBtCA"}
|
2
node_modules/@any-touch/pinch/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/pinch/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"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(r,o){var n=e.createPluginContext(a,o);return r.compute([t.ComputeVectorForMutli,t.ComputeScale],(function(t){if(e.resetState(n),!e.isDisabled(n)){var a,o,i=(a=t.pointLength,o=t.scale,t.deltaScale,t.phase,n.pointLength===a&&n.threshold<Math.abs(o-1));n.state=e.flow(i,n.state,t.phase);var s=n.name;if(i||e.isMoveOrEndOrCancel(n.state)){r.emit2(s,t,n);var u=t.deltaScale;1!==u&&r.emit2(s+(1<u?"in":"out"),t,n)}var c=e.getStatusName(n.state);c&&r.emit2(s+c,t,n)}})),n};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/pinch/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/pinch/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/pinch/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","pointLength","at","options","context","createPluginContext","compute","ComputeVectorForMutli","ComputeScale","computed","resetState","isDisabled","scale","isValid","Math","abs","state","flow","phase","isMoveOrEndOrCancel","emit2","deltaScale","stateName","getStatusName"],"mappings":"uIAeMA,EAAkB,CACpBC,KAAM,QAENC,UAAW,EACXC,YAAa,4BAiCQC,EAAUC,GAC/B,IAAMC,EAAUC,sBAAoBP,EAAiBK,GAyCrD,OAvCAD,EAAGI,QAAQ,CAACC,wBAAuBC,iBAAe,SAACC,GAK/C,GAHAC,aAAWN,IAGPO,aAAWP,GAAf,CACA,IAuBYH,EAAaW,EAvBnBC,GAuBMZ,EAA0CQ,cAA7BG,EAA6BH,QAAAA,aAAAA,QAE9CL,EAAQH,cAAgBA,GAGxBG,EAAQJ,UAAYc,KAAKC,IAAIH,EAAQ,IA1B7CR,EAAQY,MAAQC,OAAKJ,EAAST,EAAQY,MAAOP,EAASS,OAG9C,IAAAnB,EAASK,OACjB,GAAIS,GAAWM,sBAAoBf,EAAQY,OAAQ,CAC/Cd,EAAGkB,MAAMrB,EAAMU,EAAUL,GAEjB,IAAAiB,EAAeZ,aACnB,IAAMY,GACNnB,EAAGkB,MAAMrB,GAAQ,EAAIsB,EAAa,KAAO,OAAQZ,EAAUL,GAInE,IAAMkB,EAAYC,gBAAcnB,EAAQY,OACpCM,GACApB,EAAGkB,MAAMrB,EAAOuB,EAAWb,EAAUL,OAgBtCA"}
|
21
node_modules/@any-touch/pinch/package.json
generated
vendored
Normal file
21
node_modules/@any-touch/pinch/package.json
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@any-touch/pinch",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别捏合手势.",
|
||||
"main": "./dist/index",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/press/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/press/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
29
node_modules/@any-touch/press/README.md
generated
vendored
Normal file
29
node_modules/@any-touch/press/README.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# @any-touch/press
|
||||
**按压**识别器.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/press
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载press识别器(按压)
|
||||
import Core from '@any-touch/core';
|
||||
import press from '@any-touch/press';
|
||||
const at = new Core(el);
|
||||
at.use(press, 参数)
|
||||
|
||||
// 按压
|
||||
at.on('press', (event) => {
|
||||
// event包含位置/速度/方向等信息
|
||||
});
|
||||
```
|
||||
|
||||
## 参数
|
||||
|名称|数据类型|默认值|说明|
|
||||
|---|---|---|---|
|
||||
|name|`String`|'press'|自定义事件名称|
|
||||
|pointLength|`Number`|1|支持的触点数, 可支持多指按压|
|
||||
|maxDistance| `Number`|9|触点允许移动的最大距离|
|
||||
|minPressTime| `Number`|251|触发事件需要按压的最小时间|
|
37
node_modules/@any-touch/press/dist/index.d.ts
generated
vendored
Normal file
37
node_modules/@any-touch/press/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
|
||||
import Core from '@any-touch/core';
|
||||
declare const DEFAULT_OPTIONS: {
|
||||
name: string;
|
||||
pointLength: number;
|
||||
maxDistance: number;
|
||||
minPressTime: number;
|
||||
};
|
||||
/**
|
||||
* 实例
|
||||
*/
|
||||
declare type PressContext = PluginContext & typeof DEFAULT_OPTIONS;
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
press: PressContext;
|
||||
}
|
||||
interface EventMap {
|
||||
press: AnyTouchEvent;
|
||||
pressup: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "拖拽"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options AnyTouch选项
|
||||
* @returns
|
||||
*/
|
||||
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): PluginContext<{
|
||||
name: string;
|
||||
pointLength: number;
|
||||
maxDistance: number;
|
||||
minPressTime: number;
|
||||
}>;
|
||||
export {};
|
2
node_modules/@any-touch/press/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/press/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{createPluginContext as t,isDisabled as e,TYPE_START as n,resetState as s,TYPE_END as i,DIRECTION_UP as m,TYPE_CANCEL as a}from"@any-touch/shared";import{ComputeDistance as o}from"@any-touch/compute";const r={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function c(c,u){const p=t(r,u);let f=0;return c.compute([o],(t=>{if(e(p))return;const{phase:o,startInput:r,pointLength:u}=t;if(n===o&&p.pointLength===u)s(p),clearTimeout(f),f=setTimeout((()=>{p.state=1,c.emit2(p.name,t,p)}),p.minPressTime);else if(i===o&&1===p.state)c.emit2(`${p.name}${m}`,t,p);else if(1!==p.state){const e=t.timestamp-r.timestamp;(!function(){const{distance:e}=t;return e&&p.maxDistance>e}()||p.minPressTime>e&&[i,a].includes(o))&&(clearTimeout(f),p.state=2)}})),p}export{c as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/press/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/press/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/press/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","pointLength","maxDistance","minPressTime","at","options","context","createPluginContext","timeoutId","compute","ComputeDistance","computed","isDisabled","phase","startInput","TYPE_START","resetState","clearTimeout","setTimeout","state","emit2","TYPE_END","DIRECTION_UP","deltaTime","timestamp","distance","test","TYPE_CANCEL","includes"],"mappings":"8MAQA,MAAMA,EAAkB,CACpBC,KAAM,QACNC,YAAa,EACbC,YAAa,EACbC,aAAc,gBA6BOC,EAAUC,GAC/B,MAAMC,EAAUC,EAAoBR,EAAiBM,GAErD,IAAIG,EAAY,EAiDhB,OA7CAJ,EAAGK,QAAQ,CAACC,IAAmBC,IAE3B,GAAIC,EAAWN,GAAU,OACzB,MAAMO,MAAEA,EAAKC,WAAEA,EAAUb,YAAEA,GAAgBU,EAI3C,GAAII,IAAeF,GAASP,EAAQL,cAAgBA,EAEhDe,EAAWV,GAGXW,aAAaT,GACbA,EAAaU,YAAoC,KAC7CZ,EAAQa,QACRf,EAAGgB,MAAMd,EAAQN,KAAMW,EAAUL,KAClCA,EAAQH,mBAKV,GAAIkB,IAAaR,GAAS,IAAqBP,EAAQa,MACxDf,EAAGgB,MAAM,GAAGd,EAAQN,OAAOsB,IAAgBX,EAAUL,QAEpD,GAAI,IAAqBA,EAAQa,MAAO,CACzC,MAAMI,EAAYZ,EAASa,UAAYV,EAAWU,YAetD,WACI,MAAMC,SAAEA,GAAad,EACrB,OAAOc,GAAYnB,EAAQJ,YAAcuB,EAdpCC,IAEApB,EAAQH,aAAeoB,GAAa,CAACF,EAAUM,GAAaC,SAASf,MACtEI,aAAaT,GACbF,EAAQa,aAabb"}
|
2
node_modules/@any-touch/press/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/press/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@any-touch/shared"),t=require("@any-touch/compute"),i={name:"press",pointLength:1,maxDistance:9,minPressTime:251};exports.default=function(a,s){var n=e.createPluginContext(i,s),r=0;return a.compute([t.ComputeDistance],(function(t){if(!e.isDisabled(n)){var i,s=t.phase,m=t.startInput,c=t.pointLength;if(e.TYPE_START===s&&n.pointLength===c)e.resetState(n),clearTimeout(r),r=setTimeout((function(){n.state=1,a.emit2(n.name,t,n)}),n.minPressTime);else if(e.TYPE_END===s&&1===n.state)a.emit2("".concat(n.name).concat(e.DIRECTION_UP),t,n);else if(1!==n.state){var o=t.timestamp-m.timestamp;(!((i=t.distance)&&n.maxDistance>i)||n.minPressTime>o&&[e.TYPE_END,e.TYPE_CANCEL].includes(s))&&(clearTimeout(r),n.state=2)}}})),n};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/press/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/press/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/press/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","pointLength","maxDistance","minPressTime","at","options","context","createPluginContext","timeoutId","compute","ComputeDistance","computed","isDisabled","distance","phase","startInput","TYPE_START","resetState","clearTimeout","setTimeout","state","emit2","TYPE_END","DIRECTION_UP","deltaTime","timestamp","TYPE_CANCEL","includes"],"mappings":"uIAQMA,EAAkB,CACpBC,KAAM,QACNC,YAAa,EACbC,YAAa,EACbC,aAAc,8BA6BOC,EAAUC,GAC/B,IAAMC,EAAUC,sBAAoBR,EAAiBM,GAEjDG,EAAY,EAiDhB,OA7CAJ,EAAGK,QAAQ,CAACC,oBAAkB,SAACC,GAE3B,IAAIC,aAAWN,GAAf,CACQ,IAsCIO,EAtCJC,EAAmCH,QAA5BI,EAA4BJ,aAAhBV,EAAgBU,cAI3C,GAAIK,eAAeF,GAASR,EAAQL,cAAgBA,EAEhDgB,aAAWX,GAGXY,aAAaV,GACbA,EAAaW,YAAoC,WAC7Cb,EAAQc,QACRhB,EAAGiB,MAAMf,EAAQN,KAAMW,EAAUL,KAClCA,EAAQH,mBAKV,GAAImB,aAAaR,GAAS,IAAqBR,EAAQc,MACxDhB,EAAGiB,MAAM,UAAGf,EAAQN,aAAOuB,gBAAgBZ,EAAUL,QAEpD,GAAI,IAAqBA,EAAQc,MAAO,CACzC,IAAMI,EAAYb,EAASc,UAAYV,EAAWU,cAgB1CZ,EAAaF,aACFL,EAAQJ,YAAcW,IAZpCP,EAAQH,aAAeqB,GAAa,CAACF,WAAUI,eAAaC,SAASb,MACtEI,aAAaV,GACbF,EAAQc,cAabd"}
|
22
node_modules/@any-touch/press/package.json
generated
vendored
Normal file
22
node_modules/@any-touch/press/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@any-touch/press",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别按压手势.",
|
||||
"main": "./dist/index",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/rotate/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/rotate/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
29
node_modules/@any-touch/rotate/README.md
generated
vendored
Normal file
29
node_modules/@any-touch/rotate/README.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# @any-touch/rotate
|
||||
**旋转**识别器.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/rotate
|
||||
```
|
||||
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载rotate识别器(拖拽)
|
||||
import Core from '@any-touch/core';
|
||||
import rotate from '@any-touch/rotate';
|
||||
const at = new Core(el);
|
||||
at.use(rotate, 参数);
|
||||
|
||||
// 拖拽
|
||||
at.on('rotate', (event) => {
|
||||
// event包含位置/速度/方向等信息
|
||||
});
|
||||
```
|
||||
|
||||
## 参数
|
||||
|名称|数据类型|默认值|说明|
|
||||
|---|---|---|---|
|
||||
|name|`String`|'rotate'|自定义事件名称|
|
||||
|pointLength|`Number`|2|支持的触点数, 可支持多指拖拽|
|
||||
|threshold| `Number`|0|旋转超过0°才触发rotate事件|
|
34
node_modules/@any-touch/rotate/dist/index.d.ts
generated
vendored
Normal file
34
node_modules/@any-touch/rotate/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
|
||||
import Core from '@any-touch/core';
|
||||
declare const DEFAULT_OPTIONS: {
|
||||
name: string;
|
||||
threshold: number;
|
||||
pointLength: number;
|
||||
};
|
||||
/**
|
||||
* 实例
|
||||
*/
|
||||
declare type RotateContext = PluginContext & typeof DEFAULT_OPTIONS;
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
rotate: RotateContext;
|
||||
}
|
||||
interface EventMap {
|
||||
rotate: AnyTouchEvent;
|
||||
rotatestart: AnyTouchEvent;
|
||||
rotatemove: AnyTouchEvent;
|
||||
rotateend: AnyTouchEvent;
|
||||
rotatecancel: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "旋转"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options 识别器选项
|
||||
* @returns
|
||||
*/
|
||||
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): any;
|
||||
export {};
|
2
node_modules/@any-touch/rotate/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/rotate/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{createPluginContext as t,isDisabled as e,resetState as n,flow as o,isMoveOrEndOrCancel as a,getStatusName as s}from"@any-touch/shared";import{ComputeVectorForMutli as r,ComputeAngle as c}from"@any-touch/compute";const h={name:"rotate",threshold:0,pointLength:2};function i(i,m){const u=t(h,m);return i.compute([r,c],(t=>{if(e(u))return;n(u);const r=function(){const{pointLength:e,angle:n}=t;return u.pointLength===e&&u.threshold<Math.abs(n)}();u.state=o(r,u.state,t.phase);const{name:c}=u;(r||a(u.state))&&i.emit2(c,t,u);const h=s(u.state);h&&i.emit2(c+h,t,u)})),u}export{i as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/rotate/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/rotate/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/rotate/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","pointLength","at","options","context","createPluginContext","compute","ComputeVectorForMutli","ComputeAngle","computed","isDisabled","resetState","isValid","angle","Math","abs","test","state","flow","phase","isMoveOrEndOrCancel","emit2","stateName","getStatusName"],"mappings":"2NAWA,MAAMA,EAAkB,CACpBC,KAAM,SAENC,UAAW,EACXC,YAAa,cA+BQC,EAAUC,GAC/B,MAAMC,EAAUC,EAAoBP,EAAiBK,GA4BrD,OAzBAD,EAAGI,QAAQ,CAACC,EAAuBC,IAAgBC,IAE/C,GAAIC,EAAWN,GAAU,OAGzBO,EAAWP,GAEX,MAAMQ,EAaN,WACI,MAAMX,YAAEA,EAAWY,MAAEA,GAAUJ,EAC/B,OAAOL,EAAQH,cAAgBA,GAAeG,EAAQJ,UAAYc,KAAKC,IAAIF,GAf/DG,GAChBZ,EAAQa,MAAQC,EAAKN,EAASR,EAAQa,MAAOR,EAASU,OACtD,MAAMpB,KAAEA,GAASK,GACbQ,GAAWQ,EAAoBhB,EAAQa,SACvCf,EAAGmB,MAAMtB,EAAMU,EAAUL,GAG7B,MAAMkB,EAAYC,EAAcnB,EAAQa,OACpCK,GACApB,EAAGmB,MAAMtB,EAAOuB,EAAWb,EAAUL,MAStCA"}
|
2
node_modules/@any-touch/rotate/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/rotate/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@any-touch/shared"),t=require("@any-touch/compute"),a={name:"rotate",threshold:0,pointLength:2};exports.default=function(r,o){var n=e.createPluginContext(a,o);return r.compute([t.ComputeVectorForMutli,t.ComputeAngle],(function(t){if(!e.isDisabled(n)){e.resetState(n);var a,o,s=(a=t.pointLength,o=t.angle,n.pointLength===a&&n.threshold<Math.abs(o));n.state=e.flow(s,n.state,t.phase);var u=n.name;(s||e.isMoveOrEndOrCancel(n.state))&&r.emit2(u,t,n);var i=e.getStatusName(n.state);i&&r.emit2(u+i,t,n)}})),n};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/rotate/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/rotate/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/rotate/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","pointLength","at","options","context","createPluginContext","compute","ComputeVectorForMutli","ComputeAngle","computed","isDisabled","resetState","angle","isValid","Math","abs","state","flow","phase","isMoveOrEndOrCancel","emit2","stateName","getStatusName"],"mappings":"uIAWMA,EAAkB,CACpBC,KAAM,SAENC,UAAW,EACXC,YAAa,4BA+BQC,EAAUC,GAC/B,IAAMC,EAAUC,sBAAoBP,EAAiBK,GA4BrD,OAzBAD,EAAGI,QAAQ,CAACC,wBAAuBC,iBAAe,SAACC,GAE/C,IAAIC,aAAWN,GAAf,CAGAO,aAAWP,GAEX,IAcYH,EAAaW,EAdnBC,GAcMZ,EAAuBQ,cAAVG,EAAUH,QACxBL,EAAQH,cAAgBA,GAAeG,EAAQJ,UAAYc,KAAKC,IAAIH,IAd/ER,EAAQY,MAAQC,OAAKJ,EAAST,EAAQY,MAAOP,EAASS,OAC9C,IAAAnB,EAASK,QACbS,GAAWM,sBAAoBf,EAAQY,SACvCd,EAAGkB,MAAMrB,EAAMU,EAAUL,GAG7B,IAAMiB,EAAYC,gBAAclB,EAAQY,OACpCK,GACAnB,EAAGkB,MAAMrB,EAAOsB,EAAWZ,EAAUL,OAStCA"}
|
21
node_modules/@any-touch/rotate/package.json
generated
vendored
Normal file
21
node_modules/@any-touch/rotate/package.json
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@any-touch/rotate",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别旋转手势.",
|
||||
"main": "./dist/index",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/shared/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/shared/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
13
node_modules/@any-touch/shared/README.md
generated
vendored
Normal file
13
node_modules/@any-touch/shared/README.md
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# @any-touch/shared
|
||||
在这里可以找到状态马
|
||||
|
||||
```javascript
|
||||
// shared内部代码
|
||||
export const STATUS_POSSIBLE = 'possible';
|
||||
export const STATUS_START = 'start';
|
||||
export const STATUS_MOVE = 'move';
|
||||
export const STATUS_END = 'end';
|
||||
export const STATUS_CANCELLED = 'cancel';
|
||||
export const STATUS_FAILED = 'failed';
|
||||
export const STATUS_RECOGNIZED = 'recognized';
|
||||
```
|
34
node_modules/@any-touch/shared/dist/const.d.ts
generated
vendored
Normal file
34
node_modules/@any-touch/shared/dist/const.d.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 是否微信
|
||||
*/
|
||||
export declare const CLIENT_X = "clientX";
|
||||
export declare const CLIENT_Y = "clientY";
|
||||
/**
|
||||
* 计算方向/速度的时间间隔
|
||||
*/
|
||||
export declare const COMPUTE_INTERVAL = 16;
|
||||
/**
|
||||
* 输入阶段
|
||||
*/
|
||||
export declare const TYPE_START = "start";
|
||||
export declare const TYPE_MOVE = "move";
|
||||
export declare const TYPE_CANCEL = "cancel";
|
||||
export declare const TYPE_END = "end";
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
export declare const DIRECTION_LEFT = "left";
|
||||
export declare const DIRECTION_RIGHT = "right";
|
||||
export declare const DIRECTION_UP = "up";
|
||||
export declare const DIRECTION_DOWN = "down";
|
||||
export declare const TOUCH = "touch";
|
||||
export declare const MOUSE = "mouse";
|
||||
export declare const enum STATE {
|
||||
POSSIBLE = 0,
|
||||
RECOGNIZED = 1,
|
||||
FAILED = 2,
|
||||
CANCELLED = 3,
|
||||
START = 4,
|
||||
MOVE = 5,
|
||||
END = 1
|
||||
}
|
2
node_modules/@any-touch/shared/dist/createPluginContext.d.ts
generated
vendored
Normal file
2
node_modules/@any-touch/shared/dist/createPluginContext.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import { PluginContext, PluginOptions } from "./types";
|
||||
export declare function createPluginContext<D extends Required<PluginOptions>>(defaultOptions: D, options?: PluginOptions): PluginContext<D>;
|
5
node_modules/@any-touch/shared/dist/index.d.ts
generated
vendored
Normal file
5
node_modules/@any-touch/shared/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
export * from './const';
|
||||
export * from './types';
|
||||
export * from './pressMoveFlow';
|
||||
export * from './createPluginContext';
|
||||
export declare function round2(n: number): number;
|
2
node_modules/@any-touch/shared/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/shared/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
const n="clientX",e="clientY",t=16,c="start",o="move",s="cancel",u="end",a="left",i="right",r="up",d="down",l="touch",f="mouse",m={4:"start",5:"move",1:"end",3:"cancel"};function v(n){return m[n]}function b(n,e,t){const c={1:{0:{move:4},4:{move:5,end:1,cancel:3},5:{move:5,end:1,cancel:3}},0:{4:{move:2,end:1,cancel:3},5:{start:2,move:2,end:1,cancel:3}}}[Number(n)][e];return void 0!==c&&c[t]||0}function g(n){[1,3,2].includes(n.state)&&(n.state=0)}function h(n){return[5,1,3].includes(n)}function j(n){if(n.disabled)return n.state=0,!0}function O(n,e){return Object.assign(Object.assign(Object.assign({},n),e),{state:0,disabled:!1})}function p(n){return Math.round(100*n)/100}export{n as CLIENT_X,e as CLIENT_Y,t as COMPUTE_INTERVAL,d as DIRECTION_DOWN,a as DIRECTION_LEFT,i as DIRECTION_RIGHT,r as DIRECTION_UP,f as MOUSE,l as TOUCH,s as TYPE_CANCEL,u as TYPE_END,o as TYPE_MOVE,c as TYPE_START,O as createPluginContext,b as flow,v as getStatusName,j as isDisabled,h as isMoveOrEndOrCancel,g as resetState,p as round2};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/shared/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/shared/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/shared/src/const.ts","../../../../packages/shared/src/pressMoveFlow.ts","../../../../packages/shared/src/createPluginContext.ts","../../../../packages/shared/src/index.ts"],"sourcesContent":[null,null,null,null],"names":["CLIENT_X","CLIENT_Y","COMPUTE_INTERVAL","TYPE_START","TYPE_MOVE","TYPE_CANCEL","TYPE_END","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","TOUCH","MOUSE","STATUS_CODE_AND_NAME_MAP","getStatusName","code","flow","isVaild","lastStatus","phase","map","move","end","cancel","start","Number","resetState","context","includes","state","isMoveOrEndOrCancel","isDisabled","disabled","createPluginContext","defaultOptions","options","round2","n","Math","round"],"mappings":"MAKaA,EAAW,UACXC,EAAW,UAIXC,EAAmB,GAKnBC,EAAa,QACbC,EAAY,OACZC,EAAc,SACdC,EAAW,MAMXC,EAAiB,OACjBC,EAAkB,QAClBC,EAAe,KACfC,EAAiB,OAEjBC,EAAQ,QACRC,EAAQ,QCpBfC,EAA6F,CAC/F,EDIsB,QCHtB,EDIqB,OCHrB,EDKoB,MCJpB,EDGuB,mBCKXC,EAAcC,GAC1B,OAAOF,EAAyBE,YAYpBC,EAAKC,EAAkBC,EAA8BC,GAajE,MA6CMC,EA7CkC,CACpC,EAAG,CACC,EAAkB,CAGdC,QAOJ,EAAe,CACXA,OACAC,MACAC,UAGJ,EAAc,CACVF,OACAC,MACAC,WAKR,EAAG,CAGC,EAAe,CAGXF,OACAC,MACAC,UAGJ,EAAc,CACVC,QACAH,OACAC,MACAC,YAIUE,OAAOR,IAAUC,GAGvC,YAAQ,IAAWE,GAAOA,EAAID,eAOlBO,EAAWC,GACnB,QAAkDC,SAASD,EAAQE,SACnEF,EAAQE,kBASAC,EAAoBD,GAChC,MAAO,QAAwCD,SAASC,YAQ5CE,EAAWJ,GACvB,GAAIA,EAAQK,SAER,OADAL,EAAQE,SACD,WC5HCI,EAAuDC,EAAmBC,GACtF,oDAAYD,GAAmBC,IAASN,QAAuBG,UAAU,aCC7DI,EAAOC,GACnB,OAAOC,KAAKC,MAAU,IAAJF,GAAW"}
|
2
node_modules/@any-touch/shared/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/shared/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=((e={})[4]="start",e[5]="move",e[1]="end",e[3]="cancel",e);exports.CLIENT_X="clientX",exports.CLIENT_Y="clientY",exports.COMPUTE_INTERVAL=16,exports.DIRECTION_DOWN="down",exports.DIRECTION_LEFT="left",exports.DIRECTION_RIGHT="right",exports.DIRECTION_UP="up",exports.MOUSE="mouse",exports.TOUCH="touch",exports.TYPE_CANCEL="cancel",exports.TYPE_END="end",exports.TYPE_MOVE="move",exports.TYPE_START="start",exports.createPluginContext=function(e,r){return t.__assign(t.__assign(t.__assign({},e),r),{state:0,disabled:!1})},exports.flow=function(e,t,r){var s,n,o,a,c,i,u,p={1:(s={},s[0]=(n={},n.move=4,n),s[4]=(o={},o.move=5,o.end=1,o.cancel=3,o),s[5]=(a={},a.move=5,a.end=1,a.cancel=3,a),s),0:(c={},c[4]=(i={},i.move=2,i.end=1,i.cancel=3,i),c[5]=(u={},u.start=2,u.move=2,u.end=1,u.cancel=3,u),c)}[Number(e)][t];return void 0!==p&&p[r]||0},exports.getStatusName=function(e){return r[e]},exports.isDisabled=function(e){if(e.disabled)return e.state=0,!0},exports.isMoveOrEndOrCancel=function(e){return[5,1,3].includes(e)},exports.resetState=function(e){[1,3,2].includes(e.state)&&(e.state=0)},exports.round2=function(e){return Math.round(100*e)/100};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/shared/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/shared/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/shared/src/pressMoveFlow.ts","../../../../packages/shared/src/const.ts","../../../../packages/shared/src/createPluginContext.ts","../../../../packages/shared/src/index.ts"],"sourcesContent":[null,null,null,null],"names":["STATUS_CODE_AND_NAME_MAP","_a","defaultOptions","options","state","disabled","isVaild","lastStatus","phase","map","_b","_c","_d","_e","_f","_g","Number","code","context","includes","n","Math","round"],"mappings":"6FAUMA,aCKoB,QDHtBC,KCIqB,ODHrBA,KCKoB,MDJpBA,KCGuB,6BAZH,2BACA,mCAIQ,0BAiBF,8BAHA,+BACC,6BACH,mBAIP,sBADA,4BAZM,0BACH,wBAFC,0BADC,6CCb6CC,EAAmBC,GACtF,2CAAYD,GAAmBC,IAASC,QAAuBC,UAAU,2BFgCxDC,EAAkBC,EAA8BC,qBA0D3DC,EA7CkC,CACpC,QACIR,WAGIS,EAAU,UAOdT,WACIU,EAAU,OACVA,EAAS,MACTA,EAAY,YAGhBV,WACIW,EAAU,OACVA,EAAS,MACTA,EAAY,eAKpB,QAGIC,WAGIC,EAAU,OACVA,EAAS,MACTA,EAAY,YAGhBD,WACIE,EAAW,QACXA,EAAU,OACVA,EAAS,MACTA,EAAY,gBAIFC,OAAOV,IAAUC,GAGvC,YAAQ,IAAWE,GAAOA,EAAID,sCA1EJS,GAC1B,OAAOjB,EAAyBiB,gCAoGTC,GACvB,GAAIA,EAAQb,SAER,OADAa,EAAQd,SACD,wCAZqBA,GAChC,MAAO,QAAwCe,SAASf,gCAZjCc,GACnB,QAAkDC,SAASD,EAAQd,SACnEc,EAAQd,kCGrGOgB,GACnB,OAAOC,KAAKC,MAAU,IAAJF,GAAW"}
|
35
node_modules/@any-touch/shared/dist/pressMoveFlow.d.ts
generated
vendored
Normal file
35
node_modules/@any-touch/shared/dist/pressMoveFlow.d.ts
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import { RECOGNIZER_STATE } from './index';
|
||||
import { PluginContext } from './types';
|
||||
/**
|
||||
* 获取状态字符串
|
||||
* @param code 状态代码
|
||||
* @returns
|
||||
*/
|
||||
export declare function getStatusName(code: RECOGNIZER_STATE): "end" | "start" | "cancel" | "move";
|
||||
/**
|
||||
* 😊如果当前识别成功,
|
||||
* 那么计算当前识别器状态.
|
||||
* 逻辑: 是否test通过 + 上一轮识别器状态 + 输入阶段 => 当前识别器状态
|
||||
* @param isVaild 是否通过test
|
||||
* @param lastStatus 上一轮识别器状态
|
||||
* @param phase 输入阶段
|
||||
* @returns 识别器状态
|
||||
*/
|
||||
export declare function flow(isVaild: boolean, lastStatus: RECOGNIZER_STATE, phase: string): RECOGNIZER_STATE;
|
||||
/**
|
||||
* 重置状态到possible
|
||||
* @param context 识别器实例
|
||||
*/
|
||||
export declare function resetState(context: PluginContext): void;
|
||||
/**
|
||||
* 是否事件的结束
|
||||
* @param state
|
||||
* @returns 是否
|
||||
*/
|
||||
export declare function isMoveOrEndOrCancel(state: RECOGNIZER_STATE): boolean;
|
||||
/**
|
||||
* 判断是否禁止识别
|
||||
* @param context 识别器实例
|
||||
* @returns 是否禁止识别
|
||||
*/
|
||||
export declare function isDisabled(context: PluginContext): boolean;
|
169
node_modules/@any-touch/shared/dist/types.d.ts
generated
vendored
Normal file
169
node_modules/@any-touch/shared/dist/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,169 @@
|
||||
import Core from '@any-touch/core';
|
||||
import { STATE } from './const';
|
||||
export declare type KV = Record<string, any>;
|
||||
/**
|
||||
* 适配器支持的事件类型
|
||||
*/
|
||||
export declare type NativeEvent = MouseEvent | TouchEvent;
|
||||
export interface PointClientXY {
|
||||
target: EventTarget | null;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
}
|
||||
/**
|
||||
* 输入阶段
|
||||
*/
|
||||
export declare type phase = 'start' | 'move' | 'end' | 'cancel';
|
||||
/**
|
||||
* 原生事件上选取的共有字段
|
||||
*/
|
||||
export interface PubicEvent {
|
||||
readonly phase: phase;
|
||||
readonly changedPoints: PointClientXY[];
|
||||
readonly points: PointClientXY[];
|
||||
readonly target: EventTarget | null;
|
||||
readonly targets: (EventTarget | null)[];
|
||||
readonly nativeEvent: Event;
|
||||
}
|
||||
/**
|
||||
* 不包含prevInput/startInput/startMultiInput的Input
|
||||
*/
|
||||
export interface InputOnlyHasCurrent extends PubicEvent {
|
||||
readonly id: number;
|
||||
readonly isStart: boolean;
|
||||
readonly isEnd: boolean;
|
||||
readonly pointLength: number;
|
||||
readonly timestamp: number;
|
||||
readonly target: EventTarget | null;
|
||||
readonly currentTarget: EventTarget | null;
|
||||
readonly center?: Point;
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
readonly getOffset: (el: HTMLElement) => {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 提供给插件(compute函数)之前的统一化数据
|
||||
*/
|
||||
export interface Input extends InputOnlyHasCurrent {
|
||||
readonly startInput: InputOnlyHasCurrent;
|
||||
readonly startMultiInput?: InputOnlyHasCurrent;
|
||||
readonly prevInput?: InputOnlyHasCurrent;
|
||||
}
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
export declare type directionString = 'up' | 'right' | 'down' | 'left' | 'none';
|
||||
/**
|
||||
* 点
|
||||
*/
|
||||
export interface Point {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
export declare type Vector = Point;
|
||||
/**
|
||||
* Input执行计算后的数据格式
|
||||
*/
|
||||
export interface Computed extends KV {
|
||||
readonly maxPointLength?: number;
|
||||
readonly velocityX?: number;
|
||||
readonly velocityY?: number;
|
||||
readonly speedX?: number;
|
||||
readonly speedY?: number;
|
||||
readonly scale?: number;
|
||||
readonly deltaScale?: number;
|
||||
readonly angle?: number;
|
||||
readonly deltaAngle?: number;
|
||||
readonly deltaX?: number;
|
||||
readonly deltaY?: number;
|
||||
readonly deltaXYAngle?: number;
|
||||
readonly displacementX?: number;
|
||||
readonly displacementY?: number;
|
||||
readonly distanceX?: number;
|
||||
readonly distanceY?: number;
|
||||
readonly distance?: number;
|
||||
readonly deltaTime?: number;
|
||||
readonly overallDirection?: directionString;
|
||||
readonly direction?: directionString;
|
||||
readonly startVecotr?: Vector;
|
||||
readonly prevVecotr?: Vector;
|
||||
readonly activeVecotr?: Vector;
|
||||
}
|
||||
export interface AnyTouchEvent extends Input, Required<Computed> {
|
||||
readonly type: string;
|
||||
readonly stopPropagation: () => void;
|
||||
readonly stopImmediatePropagation: () => void;
|
||||
readonly preventDefault: () => void;
|
||||
}
|
||||
/**
|
||||
* 识别器状态
|
||||
*/
|
||||
export declare type RECOGNIZER_STATE = STATE;
|
||||
/**
|
||||
* Input转换器
|
||||
*/
|
||||
export interface InputCreatorFunction<T> {
|
||||
(event: T): void | Input;
|
||||
}
|
||||
/**
|
||||
* Input转换器外壳函数映射
|
||||
*/
|
||||
export interface InputCreatorFunctionMap {
|
||||
[k: string]: InputCreatorFunction<NativeEvent>;
|
||||
}
|
||||
export declare type PluginOptions = {
|
||||
name?: string;
|
||||
} & KV;
|
||||
/**
|
||||
* 插件上下文内容
|
||||
*/
|
||||
export declare type PluginContext<D extends Required<PluginOptions> = Required<PluginOptions>> = {
|
||||
state: RECOGNIZER_STATE;
|
||||
disabled: boolean;
|
||||
} & D;
|
||||
/**
|
||||
* 插件
|
||||
*/
|
||||
export declare type Plugin = (context: Core, pluginOptions?: PluginOptions) => PluginContext;
|
||||
/**
|
||||
* 计算函数
|
||||
*/
|
||||
export declare type ComputeFunction = (input: Input, computed: Partial<Computed>) => Computed | void;
|
||||
/**
|
||||
* 计算函数生成器
|
||||
*/
|
||||
export declare type ComputeFunctionCreator = () => ComputeFunction;
|
||||
/**
|
||||
* 仅用来作为识别器和at通知的载体函数
|
||||
*/
|
||||
export interface EventTrigger {
|
||||
(type: string): void;
|
||||
}
|
||||
import tap from '@any-touch/tap';
|
||||
import press from '@any-touch/press';
|
||||
import swipe from '@any-touch/swipe';
|
||||
import pan from '@any-touch/pan';
|
||||
import pinch from '@any-touch/pinch';
|
||||
import rotate from '@any-touch/rotate';
|
||||
export declare type TapContext = ReturnType<typeof tap>;
|
||||
export declare type PressContext = ReturnType<typeof press>;
|
||||
export declare type SwipeContext = ReturnType<typeof swipe>;
|
||||
export declare type PanContext = ReturnType<typeof pan>;
|
||||
export declare type PinchContext = ReturnType<typeof pinch>;
|
||||
export declare type RotateContext = ReturnType<typeof rotate>;
|
||||
/**
|
||||
* 插件实例映射
|
||||
* {名称: 插件实例}
|
||||
*/
|
||||
export interface PluginContextMap {
|
||||
tap: TapContext;
|
||||
press: PressContext;
|
||||
swipe: SwipeContext;
|
||||
pan: PanContext;
|
||||
pinch: PinchContext;
|
||||
rotate: RotateContext;
|
||||
}
|
||||
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
17
node_modules/@any-touch/shared/package.json
generated
vendored
Normal file
17
node_modules/@any-touch/shared/package.json
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@any-touch/shared",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch内部的公共函数.",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/swipe/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/swipe/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
29
node_modules/@any-touch/swipe/README.md
generated
vendored
Normal file
29
node_modules/@any-touch/swipe/README.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# @any-touch/swipe
|
||||
**快划**识别器.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/swipe
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载rotate识别器(旋转)
|
||||
import Core from '@any-touch/core';
|
||||
import swipe from '@any-touch/swipe';
|
||||
const at = new Core(el);
|
||||
at.use(swipe, 参数)
|
||||
|
||||
// 旋转
|
||||
at.on('swipe', (event) => {
|
||||
// event包含位置/速度/方向等信息
|
||||
});
|
||||
```
|
||||
|
||||
## 参数
|
||||
|名称|数据类型|默认值|说明|
|
||||
|---|---|---|---|
|
||||
|name|`String`|'swipe'|自定义事件名称|
|
||||
|pointLength|`Number`|1|支持的触点数, 可支持多指触发|
|
||||
|threshold| `Number`|10|触点离开前, 按压移动的距离超过10px才能触发事件|
|
||||
|velocity| `Number`|0.3|快划超过30px/ms才触发事件|
|
35
node_modules/@any-touch/swipe/dist/index.d.ts
generated
vendored
Normal file
35
node_modules/@any-touch/swipe/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
|
||||
import Core from '@any-touch/core';
|
||||
declare const DEFAULT_OPTIONS: {
|
||||
name: string;
|
||||
threshold: number;
|
||||
velocity: number;
|
||||
pointLength: number;
|
||||
};
|
||||
/**
|
||||
* 实例
|
||||
*/
|
||||
declare type SwipeContext = PluginContext & typeof DEFAULT_OPTIONS;
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
swipe: SwipeContext;
|
||||
}
|
||||
interface EventMap {
|
||||
swipe: AnyTouchEvent;
|
||||
swipeup: AnyTouchEvent;
|
||||
swiperight: AnyTouchEvent;
|
||||
swipedown: AnyTouchEvent;
|
||||
swipeleft: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "拖拽"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options 识别器选项
|
||||
* @returns
|
||||
*/
|
||||
export default function (at: Core, options?: Partial<typeof DEFAULT_OPTIONS>): SwipeContext;
|
||||
export {};
|
2
node_modules/@any-touch/swipe/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/swipe/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{createPluginContext as t,TYPE_END as e}from"@any-touch/shared";import{ComputeDistance as o,ComputeVAndDir as n,ComputeMaxLength as i}from"@any-touch/compute";const c={name:"swipe",threshold:10,velocity:.3,pointLength:1};function a(a,r){const s=t(c,r);return a.compute([o,n,i],(t=>{if(s.state=0,!s.disabled&&function(){if(e!==t.phase)return!1;const{velocityX:o,velocityY:n,distance:i,maxPointLength:c}=t;return c===s.pointLength&&0===t.points.length&&s.threshold<i&&s.velocity<Math.max(o,n)}()){const{name:e}=s;s.state=1,a.emit2(e,t,s),a.emit2(e+t.direction,t,s)}})),s}export{a as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/swipe/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/swipe/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/swipe/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","velocity","pointLength","at","options","context","createPluginContext","compute","ComputeDistance","ComputeVAndDir","ComputeMaxLength","computed","state","disabled","TYPE_END","phase","velocityX","velocityY","distance","maxPointLength","points","length","Math","max","test","emit2","direction"],"mappings":"qKAIA,MAAMA,EAAkB,CACpBC,KAAM,QACNC,UAAW,GACXC,SAAU,GACVC,YAAa,cA+BQC,EAAUC,GAC/B,MAAMC,EAAUC,EAAoBR,EAAiBM,GA4BrD,OAzBAD,EAAGI,QAAQ,CAACC,EAAiBC,EAAgBC,IAAoBC,IAE7D,GADAN,EAAQO,SACJP,EAAQQ,UAUZ,WACI,GAAIC,IAAaH,EAASI,MAAO,OAAO,EACxC,MAAMC,UAAEA,EAASC,UAAEA,EAASC,SAAEA,EAAQC,eAAEA,GAAmBR,EAC3D,OACIQ,IAAmBd,EAAQH,aAG3B,IAAMS,EAASS,OAAOC,QACtBhB,EAAQL,UAAYkB,GACpBb,EAAQJ,SAAWqB,KAAKC,IAAIP,EAAWC,GAjB3CO,GAAQ,CACR,MAAMzB,KAAEA,GAASM,EACjBA,EAAQO,QACRT,EAAGsB,MAAM1B,EAAMY,EAAUN,GACzBF,EAAGsB,MAAM1B,EAAOY,EAASe,UAAWf,EAAUN,OAiB/CA"}
|
2
node_modules/@any-touch/swipe/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/swipe/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@any-touch/shared"),t=require("@any-touch/compute"),n={name:"swipe",threshold:10,velocity:.3,pointLength:1};exports.default=function(i,o){var r=e.createPluginContext(n,o);return i.compute([t.ComputeDistance,t.ComputeVAndDir,t.ComputeMaxLength],(function(t){if(r.state=0,!r.disabled&&function(){if(e.TYPE_END!==t.phase)return!1;var n=t.velocityX,i=t.velocityY,o=t.distance;return t.maxPointLength===r.pointLength&&0===t.points.length&&r.threshold<o&&r.velocity<Math.max(n,i)}()){var n=r.name;r.state=1,i.emit2(n,t,r),i.emit2(n+t.direction,t,r)}})),r};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/swipe/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/swipe/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/swipe/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","threshold","velocity","pointLength","at","options","context","createPluginContext","compute","ComputeDistance","ComputeVAndDir","ComputeMaxLength","computed","state","disabled","TYPE_END","phase","velocityX","velocityY","distance","points","length","Math","max","test","name_1","emit2","direction"],"mappings":"uIAIMA,EAAkB,CACpBC,KAAM,QACNC,UAAW,GACXC,SAAU,GACVC,YAAa,4BA+BQC,EAAUC,GAC/B,IAAMC,EAAUC,sBAAoBR,EAAiBM,GA4BrD,OAzBAD,EAAGI,QAAQ,CAACC,kBAAiBC,iBAAgBC,qBAAmB,SAACC,GAE7D,GADAN,EAAQO,SACJP,EAAQQ,UAUZ,WACI,GAAIC,aAAaH,EAASI,MAAO,OAAO,EAChC,IAAAC,EAAmDL,YAAxCM,EAAwCN,YAA7BO,EAA6BP,WAC3D,OAD2DA,mBAEpCN,EAAQH,aAG3B,IAAMS,EAASQ,OAAOC,QACtBf,EAAQL,UAAYkB,GACpBb,EAAQJ,SAAWoB,KAAKC,IAAIN,EAAWC,GAjB3CM,GAAQ,CACA,IAAAC,EAASnB,OACjBA,EAAQO,QACRT,EAAGsB,MAAMD,EAAMb,EAAUN,GACzBF,EAAGsB,MAAMD,EAAOb,EAASe,UAAWf,EAAUN,OAiB/CA"}
|
22
node_modules/@any-touch/swipe/package.json
generated
vendored
Normal file
22
node_modules/@any-touch/swipe/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@any-touch/swipe",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别划动手势.",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
21
node_modules/@any-touch/tap/LICENSE
generated
vendored
Normal file
21
node_modules/@any-touch/tap/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Russell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
32
node_modules/@any-touch/tap/README.md
generated
vendored
Normal file
32
node_modules/@any-touch/tap/README.md
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# @any-touch/tap
|
||||
**点击**识别器.
|
||||
|
||||
## 安装
|
||||
```shell
|
||||
npm i -S @any-touch/tap
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
```javascript
|
||||
// 只加载tap识别器(点击)
|
||||
import Core from '@any-touch/core';
|
||||
import tap from '@any-touch/tap';
|
||||
const at = new Core(el);
|
||||
at.use(tap, 参数)
|
||||
|
||||
// 点击
|
||||
at.on('tap', (event) => {
|
||||
// event包含位置/速度/方向等信息
|
||||
});
|
||||
```
|
||||
|
||||
## 参数
|
||||
|名称|数据类型|默认值|说明|
|
||||
|---|---|---|---|
|
||||
|name|`String`|'tap'|自定义事件名称|
|
||||
|pointLength|`Number`|2|支持的触点数, 可支持多指拖拽|
|
||||
|tapTimes| `Number`|1|连续点击指定次数触发|
|
||||
|waitNextTapTime| `Number`|300|最多等待下一次点击时间,超时识别器状态变为"失败"|
|
||||
|maxDistance| `Number`|2|从接触到离开允许产生的最大距离|
|
||||
|tapTmaxDistanceFromPrevTapimes| `Number`|9|2次点击之间允许的最大位移|
|
||||
|maxPressTime| `Number`|250|从接触到离开屏幕的最大容忍时间|
|
75
node_modules/@any-touch/tap/dist/index.d.ts
generated
vendored
Normal file
75
node_modules/@any-touch/tap/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* 流程如下:
|
||||
* 开始
|
||||
* |
|
||||
* <是否end阶段> - 否 - 结束
|
||||
* |
|
||||
* 关闭定时器c1和c2
|
||||
* |
|
||||
* 清除等待状态
|
||||
* |
|
||||
* 是
|
||||
* |
|
||||
* 重置状态为"可能是"
|
||||
* |
|
||||
* <是否满足单击条件> - 否 - 结束
|
||||
* |
|
||||
* 是
|
||||
* |
|
||||
* <是否正确连击:是否上次点击信息为空 或 与上次点击的位移/时间是否满足约束> - 否 - 点击次数=1 - 继续(<是否到达点击数要求>)
|
||||
* |
|
||||
* 是
|
||||
* |
|
||||
* 点击次数+1
|
||||
* |
|
||||
* <是否到达点击数要求> - 否 - 设置定时器c1(t1毫秒后状态设置为"失败") - 结束
|
||||
* |
|
||||
* 是
|
||||
* |
|
||||
* <是否需要其他手势失败> - 否 - 触发事件, 状态设置为"已识别",重置(点击次数,位置) - 结束
|
||||
* |
|
||||
* 是
|
||||
* |
|
||||
* 进入等待状态
|
||||
* |
|
||||
* <设置定时器c2(t1毫秒后检查"需要失败"的手势是否是"失败"状态, 重置(点击次数,位置, 等待状态)> - 否 - 设置状态为"失败" - 结束
|
||||
* |
|
||||
* 是
|
||||
* |
|
||||
* 触发, 状态设置为"已识别", 重置(点击次数,位置)
|
||||
* |
|
||||
* 结束
|
||||
*/
|
||||
import AnyTouch from 'any-touch';
|
||||
import type { PluginContext, AnyTouchEvent } from '@any-touch/shared';
|
||||
declare const DEFAULT_OPTIONS: {
|
||||
name: string;
|
||||
pointLength: number;
|
||||
tapTimes: number;
|
||||
waitNextTapTime: number;
|
||||
maxDistance: number;
|
||||
maxDistanceFromPrevTap: number;
|
||||
maxPressTime: number;
|
||||
};
|
||||
/**
|
||||
* 实例
|
||||
*/
|
||||
export declare type TapContext = PluginContext & typeof DEFAULT_OPTIONS;
|
||||
/**
|
||||
* 扩展插件映射
|
||||
*/
|
||||
declare module '@any-touch/core' {
|
||||
interface PluginContextMap {
|
||||
tap: TapContext;
|
||||
}
|
||||
interface EventMap {
|
||||
tap: AnyTouchEvent;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* "单击"识别器
|
||||
* @param at AnyTouch实例
|
||||
* @param options 识别器选项
|
||||
*/
|
||||
export default function (at: AnyTouch, options?: Partial<typeof DEFAULT_OPTIONS>): TapContext;
|
||||
export {};
|
2
node_modules/@any-touch/tap/dist/index.es.js
generated
vendored
Normal file
2
node_modules/@any-touch/tap/dist/index.es.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import{createPluginContext as t,isDisabled as e,TYPE_END as n}from"@any-touch/shared";import{getVLength as a}from"@any-touch/vector";import{ComputeDistance as i,ComputeMaxLength as o}from"@any-touch/compute";const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r(r,s){const c=t(m,s);let p,u,x,T=0;function f(){T=0,p=void 0,u=void 0}return r.compute([i,o],(t=>{if(e(c))return;const{phase:i,x:o,y:m}=t;n===i&&(c.state=0,!function(){const{startInput:e,pointLength:n,timestamp:a}=t,i=a-e.timestamp,{distance:o,maxPointLength:m}=t;return m===c.pointLength&&0===n&&c.maxDistance>=o&&c.maxPressTime>i}()?(f(),c.state=2):(clearTimeout(x),function(t,e){if(void 0!==p){const n=a({x:t.x-p.x,y:t.y-p.y});return p=t,e.maxDistanceFromPrevTap>=n}return p=t,!0}({x:o,y:m},c)&&function(t){const e=performance.now();if(void 0===u)return u=e,!0;{const n=e-u;return u=e,n<t}}(c.waitNextTapTime)?T++:T=1,0==T%c.tapTimes?(c.state=1,r.emit2(c.name,t,c),f()):x=setTimeout((()=>{c.state=2,f()}),c.waitNextTapTime)))})),c}export{r as default};
|
||||
//# sourceMappingURL=index.es.js.map
|
1
node_modules/@any-touch/tap/dist/index.es.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/tap/dist/index.es.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.es.js","sources":["../../../../packages/tap/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","pointLength","tapTimes","waitNextTapTime","maxDistance","maxDistanceFromPrevTap","maxPressTime","at","options","context","createPluginContext","prevTapPoint","prevTapTime","countDownToFailTimer","tapCount","reset","compute","ComputeDistance","ComputeMaxLength","computed","isDisabled","phase","x","y","TYPE_END","state","startInput","timestamp","deltaTime","distance","maxPointLength","test","clearTimeout","center","distanceFromPreviousTap","getVLength","isValidDistanceFromPrevTap","now","performance","interval","isValidInterval","emit2","setTimeout"],"mappings":"gNA+CA,MAAMA,EAAkB,CACpBC,KAAM,MAENC,YAAa,EAEbC,SAAU,EAGVC,gBAAiB,IAGjBC,YAAa,EAEbC,uBAAwB,EAExBC,aAAc,gBA0BOC,EAAcC,GACnC,MAAMC,EAAUC,EAAoBX,EAAiBS,GAErD,IAEIG,EACAC,EACAC,EAJAC,EAAW,EAQf,SAASC,IACLD,EAAW,EACXH,OAAe,EACfC,OAAc,EAsGlB,OApDAL,EAAGS,QAAQ,CAACC,EAAiBC,IAAoBC,IAE7C,GAAIC,EAAWX,GAAU,OACzB,MAAMY,MAAEA,EAAKC,EAAEA,EAACC,EAAEA,GAAMJ,EAGpBK,IAAaH,IACjBZ,EAAQgB,SA4BR,WACI,MAAMC,WAAEA,EAAUzB,YAAEA,EAAW0B,UAAEA,GAAcR,EACzCS,EAAYD,EAAYD,EAAWC,WAKnCE,SAAEA,EAAQC,eAAEA,GAAmBX,EACrC,OACIW,IAAmBrB,EAAQR,aAC3B,IAAMA,GACNQ,EAAQL,aAAeyB,GACvBpB,EAAQH,aAAesB,EArC3BG,IAoBAhB,IACAN,EAAQgB,UApBRO,aAAanB,GAzCrB,SAAoCoB,EAAezB,GAE/C,QAAI,IAAWG,EAAc,CACzB,MAAMuB,EAA0BC,EAAW,CAAEb,EAAGW,EAAOX,EAAIX,EAAaW,EAAGC,EAAGU,EAAOV,EAAIZ,EAAaY,IAGtG,OADAZ,EAAesB,EACRzB,EAAQH,wBAA0B6B,EAGzC,OADAvB,EAAesB,GACR,EAmCHG,CAA2B,CAAEd,EAAAA,EAAGC,EAAAA,GAAKd,IAzBjD,SAAyBN,GACrB,MAAMkC,EAAMC,YAAYD,MACxB,QAAI,IAAWzB,EAEX,OADAA,EAAcyB,GACP,EACJ,CACH,MAAME,EAAWF,EAAMzB,EAEvB,OADAA,EAAcyB,EACPE,EAAWpC,GAiBmCqC,CAAgB/B,EAAQN,iBACzEW,IAEAA,EAAW,EAIX,GAAMA,EAAWL,EAAQP,UACzBO,EAAQgB,QAERlB,EAAGkC,MAAMhC,EAAQT,KAAMmB,EAAUV,GACjCM,KApERF,EAAwB6B,YAAoC,KACxDjC,EAAQgB,QACRV,MACDN,EAAQN,sBA4FRM"}
|
2
node_modules/@any-touch/tap/dist/index.js
generated
vendored
Normal file
2
node_modules/@any-touch/tap/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@any-touch/shared"),t=require("@any-touch/vector"),a=require("@any-touch/compute"),i={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};exports.default=function(n,r){var o,m,s,u=e.createPluginContext(i,r),c=0;function p(){c=0,o=void 0,m=void 0}return n.compute([a.ComputeDistance,a.ComputeMaxLength],(function(a){if(!e.isDisabled(u)){var i,r,x,T,v=a.phase,f=a.x,h=a.y;if(e.TYPE_END===v)u.state=0,i=a.startInput,r=a.pointLength,x=a.timestamp-i.timestamp,T=a.distance,a.maxPointLength===u.pointLength&&0===r&&u.maxDistance>=T&&u.maxPressTime>x?(clearTimeout(s),function(e,a){if(void 0!==o){var i=t.getVLength({x:e.x-o.x,y:e.y-o.y});return o=e,a.maxDistanceFromPrevTap>=i}return o=e,!0}({x:f,y:h},u)&&function(e){var t=performance.now();if(void 0===m)return m=t,!0;var a=t-m;return m=t,a<e}(u.waitNextTapTime)?c++:c=1,0==c%u.tapTimes?(u.state=1,n.emit2(u.name,a,u),p()):s=setTimeout((function(){u.state=2,p()}),u.waitNextTapTime)):(p(),u.state=2)}})),u};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@any-touch/tap/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@any-touch/tap/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../packages/tap/src/index.ts"],"sourcesContent":[null],"names":["DEFAULT_OPTIONS","name","pointLength","tapTimes","waitNextTapTime","maxDistance","maxDistanceFromPrevTap","maxPressTime","at","options","prevTapPoint","prevTapTime","countDownToFailTimer","context","createPluginContext","tapCount","reset","compute","ComputeDistance","ComputeMaxLength","computed","isDisabled","startInput","deltaTime","distance","phase","x","y","TYPE_END","state","timestamp","clearTimeout","center","distanceFromPreviousTap","getVLength","isValidDistanceFromPrevTap","now","performance","interval","isValidInterval","emit2","setTimeout"],"mappings":"sKA+CMA,EAAkB,CACpBC,KAAM,MAENC,YAAa,EAEbC,SAAU,EAGVC,gBAAiB,IAGjBC,YAAa,EAEbC,uBAAwB,EAExBC,aAAc,8BA0BOC,EAAcC,GACnC,IAIIC,EACAC,EACAC,EANEC,EAAUC,sBAAoBd,EAAiBS,GAEjDM,EAAW,EAQf,SAASC,IACLD,EAAW,EACXL,OAAe,EACfC,OAAc,EAsGlB,OApDAH,EAAGS,QAAQ,CAACC,kBAAiBC,qBAAmB,SAACC,GAE7C,IAAIC,aAAWR,GAAf,CACQ,IAiCIS,EAAYpB,EACdqB,EAKEC,EAvCJC,EAAgBL,QAATM,EAASN,IAANO,EAAMP,IAGxB,GAAIQ,aAAaH,EACjBZ,EAAQgB,QA6BIP,EAAuCF,aAA3BlB,EAA2BkB,cACzCG,EADyCH,YACjBE,EAAWQ,UAKjCN,EAA6BJ,WAAAA,mBAEdP,EAAQX,aAC3B,IAAMA,GACNW,EAAQR,aAAemB,GACvBX,EAAQN,aAAegB,GApC3BQ,aAAanB,GAzCrB,SAAoCoB,EAAevB,GAE/C,QAAI,IAAWC,EAAc,CACzB,IAAMuB,EAA0BC,aAAW,CAAER,EAAGM,EAAON,EAAIhB,EAAagB,EAAGC,EAAGK,EAAOL,EAAIjB,EAAaiB,IAGtG,OADAjB,EAAesB,EACRvB,EAAQH,wBAA0B2B,EAGzC,OADAvB,EAAesB,GACR,EAmCHG,CAA2B,CAAET,IAAGC,KAAKd,IAzBjD,SAAyBT,GACrB,IAAMgC,EAAMC,YAAYD,MACxB,QAAI,IAAWzB,EAEX,OADAA,EAAcyB,GACP,EAEP,IAAME,EAAWF,EAAMzB,EAEvB,OADAA,EAAcyB,EACPE,EAAWlC,EAiBmCmC,CAAgB1B,EAAQT,iBACzEW,IAEAA,EAAW,EAIX,GAAMA,EAAWF,EAAQV,UACzBU,EAAQgB,QAERrB,EAAGgC,MAAM3B,EAAQZ,KAAMmB,EAAUP,GACjCG,KApERJ,EAAwB6B,YAAoC,WACxD5B,EAAQgB,QACRb,MACDH,EAAQT,mBAsEPY,IACAH,EAAQgB,aAqBThB"}
|
23
node_modules/@any-touch/tap/package.json
generated
vendored
Normal file
23
node_modules/@any-touch/tap/package.json
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@any-touch/tap",
|
||||
"version": "2.2.0",
|
||||
"description": "any-touch的识别器, 用来识别点击手势.",
|
||||
"main": "./dist/index",
|
||||
"module": "./dist/index.es.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "any86",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@any-touch/compute": "^2.2.0",
|
||||
"@any-touch/shared": "^2.2.0",
|
||||
"@any-touch/vector": "^2.2.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "c3df8dd84bd61d91f766f6d7f31dbefe6e463ce6"
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user