@any-touch/compute
Advanced tools
Comparing version 0.7.7 to 0.7.8
@@ -1,1 +0,1 @@ | ||
"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,h=p.y-r.y;i=Math.round(d/s*100)/100,u=Math.round(h/s*100)/100,o=Math.abs(i),a=Math.abs(u),n=t.getDirection(d,h)||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<e.pointLength&&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; | ||
"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<e.pointLength&&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; |
{ | ||
"name": "@any-touch/compute", | ||
"version": "0.7.7", | ||
"version": "0.7.8", | ||
"main": "dist/index.js", | ||
@@ -14,4 +14,4 @@ "module": "dist/index.es.js", | ||
"dependencies": { | ||
"@any-touch/shared": "^0.7.7", | ||
"@any-touch/vector": "^0.7.7", | ||
"@any-touch/shared": "^0.7.8", | ||
"@any-touch/vector": "^0.7.8", | ||
"tslib": "^1.9.3" | ||
@@ -22,3 +22,3 @@ }, | ||
"sideEffects": false, | ||
"gitHead": "4c1eb288b7a1f3bab7e1bebc3a225aff86b91e08" | ||
"gitHead": "14f864223c9a4df212561b9a53e93a5f89217b15" | ||
} |
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
11984
204
Updated@any-touch/shared@^0.7.8
Updated@any-touch/vector@^0.7.8