@any-touch/compute
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -0,0 +0,0 @@ import { Vector } from '@any-touch/shared'; |
@@ -0,0 +0,0 @@ declare function ComputeDeltaXY(): (input: any) => { |
@@ -0,0 +0,0 @@ declare function computeDistance(): (input: any) => { |
@@ -0,0 +0,0 @@ declare function computeMaxLength(): (input: any) => { |
@@ -0,0 +0,0 @@ import { Vector } from '@any-touch/shared'; |
@@ -0,0 +0,0 @@ declare function ComputeVAndDir(): (input: any) => { |
import { PureInput, Vector } from '@any-touch/shared'; | ||
export default function computeVector(input: PureInput): Vector; |
@@ -0,0 +0,0 @@ declare function ComputeVectorForMutli(): (input: any) => void | { |
@@ -0,0 +0,0 @@ export { default as computeAngle } from './computeAngle'; |
@@ -0,0 +0,0 @@ import { getAngle, radianToAngle, getVLength, getDirection } from '@any-touch/vector'; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var vector=require("@any-touch/vector"),shared=require("@any-touch/shared");function computeAngle(t){var e=t.startV,r=t.prevV,o=t.activeV,n=Math.round(vector.getAngle(o,r));return{angle:Math.round(vector.getAngle(o,e)),deltaAngle:n}}function ComputeDeltaXY(){return function(t){var e=t.prevInput,r=0,o=0,n=0;if(void 0!==e&&(r=t.x-e.x,o=t.y-e.y,0!==r||0!==o)){var a=Math.sqrt(Math.pow(r,2)+Math.pow(o,2));n=Math.round(vector.radianToAngle(Math.acos(Math.abs(r)/a)))}return{deltaX:r,deltaY:o,deltaXYAngle:n}}}function computeDistance(){var t=0,e=0,r=0,o=0,n=0,a=shared.NONE;return function(u){var c=u.inputType,i=u.startInput;return shared.INPUT_START===c?(t=0,e=0,r=0,o=0,n=0,a=shared.NONE):shared.INPUT_MOVE===c&&(t=Math.round(u.points[0][shared.CLIENT_X]-i.points[0][shared.CLIENT_X]),e=Math.round(u.points[0][shared.CLIENT_Y]-i.points[0][shared.CLIENT_Y]),r=Math.abs(t),o=Math.abs(e),n=Math.round(vector.getVLength({x:r,y:o})),a=vector.getDirection(t,e)),{displacementX:t,displacementY:e,distanceX:r,distanceY:o,distance:n,overallDirection:a}}}function computeMaxLength(){var t=0;return function(e){var r=e.inputType;return shared.INPUT_START===r&&(t=e.pointLength),{maxPointLength:t}}}function computeScale(t){var e=t.startV,r=t.prevV,o=t.activeV,n=shared.round2(vector.getVLength(o)/vector.getVLength(r));return{scale:shared.round2(vector.getVLength(o)/vector.getVLength(e)),deltaScale:n}}function ComputeVAndDir(){var t,e,r=0,o=0,n=0,a=0;return function(u){if(void 0!==u){var c=u.inputType;e=e||u.startInput;var i=u.timestamp-e.timestamp;if(shared.INPUT_MOVE===c&&shared.COMPUTE_INTERVAL<i){var p=u.x-e.x,s=u.y-e.y;n=Math.round(p/i*100)/100,a=Math.round(s/i*100)/100,r=Math.abs(n),o=Math.abs(a),t=vector.getDirection(p,s)||t,e=u}}return{velocityX:r,velocityY:o,speedX:n,speedY:a,direction:t}}}function computeVector(t){return{x:t.points[1][shared.CLIENT_X]-t.points[0][shared.CLIENT_X],y:t.points[1][shared.CLIENT_Y]-t.points[0][shared.CLIENT_Y]}}function ComputeVectorForMutli(){return function(t){var e=t.prevInput,r=t.startMultiInput;if(void 0!==r&&void 0!==e&&t.id!==r.id&&1<t.pointLength)return{startV:computeVector(r),prevV:computeVector(e),activeV:computeVector(t)}}}ComputeDeltaXY._id="ComputeDeltaXY",computeDistance._id="computeDistance",computeMaxLength._id="computeMaxLength",ComputeVAndDir._id="ComputeVAndDir",ComputeVectorForMutli._id="ComputeVectorForMutli",exports.ComputeDeltaXY=ComputeDeltaXY,exports.ComputeDistance=computeDistance,exports.ComputeMaxLength=computeMaxLength,exports.ComputeVAndDir=ComputeVAndDir,exports.ComputeVectorForMutli=ComputeVectorForMutli,exports.computeAngle=computeAngle,exports.computeScale=computeScale,exports.computeVector=computeVector; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@any-touch/vector"),e=require("@any-touch/shared");function n(){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}}}function r(){var n=0,r=0,o=0,a=0,i=0,u=e.NONE;return function(p){var c=p.inputType,s=p.startInput;return e.INPUT_START===c?(n=0,r=0,o=0,a=0,i=0,u=e.NONE):e.INPUT_MOVE===c&&(n=Math.round(p.points[0][e.CLIENT_X]-s.points[0][e.CLIENT_X]),r=Math.round(p.points[0][e.CLIENT_Y]-s.points[0][e.CLIENT_Y]),o=Math.abs(n),a=Math.abs(r),i=Math.round(t.getVLength({x:o,y:a})),u=t.getDirection(n,r)),{displacementX:n,displacementY:r,distanceX:o,distanceY:a,distance:i,overallDirection:u}}}function o(){var t=0;return function(n){var r=n.inputType;return e.INPUT_START===r&&(t=n.pointLength),{maxPointLength:t}}}function a(){var n,r,o=0,a=0,i=0,u=0;return function(p){if(void 0!==p){var c=p.inputType;r=r||p.startInput;var s=p.timestamp-r.timestamp;if(e.INPUT_MOVE===c&&e.COMPUTE_INTERVAL<s){var d=p.x-r.x,v=p.y-r.y;i=Math.round(d/s*100)/100,u=Math.round(v/s*100)/100,o=Math.abs(i),a=Math.abs(u),n=t.getDirection(d,v)||n,r=p}}return{velocityX:o,velocityY:a,speedX:i,speedY:u,direction:n}}}function i(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]}}function u(){return function(t){var e=t.prevInput,n=t.startMultiInput;if(void 0!==n&&void 0!==e&&t.id!==n.id&&1<t.pointLength)return{startV:i(n),prevV:i(e),activeV:i(t)}}}n._id="ComputeDeltaXY",r._id="computeDistance",o._id="computeMaxLength",a._id="ComputeVAndDir",u._id="ComputeVectorForMutli",exports.ComputeDeltaXY=n,exports.ComputeDistance=r,exports.ComputeMaxLength=o,exports.ComputeVAndDir=a,exports.ComputeVectorForMutli=u,exports.computeAngle=function(e){var n=e.startV,r=e.prevV,o=e.activeV,a=Math.round(t.getAngle(o,r));return{angle:Math.round(t.getAngle(o,n)),deltaAngle:a}},exports.computeScale=function(n){var r=n.startV,o=n.prevV,a=n.activeV,i=e.round2(t.getVLength(a)/t.getVLength(o));return{scale:e.round2(t.getVLength(a)/t.getVLength(r)),deltaScale:i}},exports.computeVector=i; |
{ | ||
"name": "@any-touch/compute", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"main": "dist/index.js", | ||
@@ -14,4 +14,4 @@ "module": "dist/index.es.js", | ||
"dependencies": { | ||
"@any-touch/shared": "^0.7.4", | ||
"@any-touch/vector": "^0.7.4", | ||
"@any-touch/shared": "^0.7.5", | ||
"@any-touch/vector": "^0.7.5", | ||
"tslib": "^1.9.3" | ||
@@ -22,3 +22,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "20cfae8bee6e95cca8dd56799f56dd48234556c4" | ||
"gitHead": "d4d3471e164e745d18940a2fd3192362a3a86edf" | ||
} |
# @any-touch/compute | ||
计算相关的函数, 比如计算距离和旋转角度. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11440
201
Updated@any-touch/shared@^0.7.5
Updated@any-touch/vector@^0.7.5