Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@any-touch/compute

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@any-touch/compute - npm Package Compare versions

Comparing version 0.7.8 to 0.7.9

3

dist/ComputeDeltaXY.d.ts

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

declare function ComputeDeltaXY(): (input: any) => {
import type { Input } from '@any-touch/shared';
declare function ComputeDeltaXY(): (input: Input) => {
deltaX: number;

@@ -3,0 +4,0 @@ deltaY: number;

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

declare function computeDistance(): (input: any) => {
import type { Input, directionString } from '@any-touch/shared';
declare function computeDistance(): (input: Input) => {
displacementX: number;

@@ -7,3 +8,3 @@ displacementY: number;

distance: number;
overallDirection: any;
overallDirection: directionString;
};

@@ -10,0 +11,0 @@ declare namespace computeDistance {

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

declare function computeMaxLength(): (input: any) => {
import type { Input } from '@any-touch/shared';
declare function computeMaxLength(): (input: Input) => {
maxPointLength: number;

@@ -3,0 +4,0 @@ };

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

declare function ComputeVAndDir(): (input: any) => {
import type { Input, directionString } from '@any-touch/shared';
declare function ComputeVAndDir(): (input: Input) => {
speedX: number;

@@ -6,3 +7,3 @@ speedY: number;

velocityY: number;
direction?: any;
direction?: directionString;
};

@@ -9,0 +10,0 @@ declare namespace ComputeVAndDir {

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

import type { PureInput, Vector } from '@any-touch/shared';
export default function computeVector(input: PureInput): Vector;
import type { InputOnlyHasCurrent, Vector } from '@any-touch/shared';
export default function computeVector(input: InputOnlyHasCurrent): Vector;

@@ -1,6 +0,7 @@

declare function ComputeVectorForMutli(): (input: any) => void | {
startV: any;
activeV: any;
prevV: any;
};
import { Vector, Input } from '@any-touch/shared';
declare function ComputeVectorForMutli(): (input: Input) => {
startV: Vector;
activeV: Vector;
prevV: Vector;
} | void;
declare namespace ComputeVectorForMutli {

@@ -7,0 +8,0 @@ var _id: string;

@@ -38,4 +38,4 @@ import { getAngle, radianToAngle, getVLength, getDirection } from '@any-touch/vector';

return function (input) {
var inputType = input.inputType, startInput = input.startInput;
if (INPUT_START === inputType) {
var stage = input.stage, startInput = input.startInput;
if (INPUT_START === stage) {
displacementX = 0;

@@ -48,3 +48,3 @@ displacementY = 0;

}
else if (INPUT_MOVE === inputType) {
else if (INPUT_MOVE === stage) {
displacementX = Math.round(input.points[0][CLIENT_X] - startInput.points[0][CLIENT_X]);

@@ -67,4 +67,4 @@ displacementY = Math.round(input.points[0][CLIENT_Y] - startInput.points[0][CLIENT_Y]);

return function (input) {
var inputType = input.inputType;
if (INPUT_START === inputType) {
var stage = input.stage;
if (INPUT_START === stage) {
maxPointLength = input.pointLength;

@@ -93,6 +93,6 @@ }

if (void 0 !== input) {
var inputType = input.inputType;
var stage = input.stage;
_lastValidInput = _lastValidInput || input.startInput;
var deltaTime = input.timestamp - _lastValidInput.timestamp;
if (INPUT_MOVE === inputType && COMPUTE_INTERVAL < deltaTime) {
if (INPUT_MOVE === stage && COMPUTE_INTERVAL < deltaTime) {
var deltaX = input.x - _lastValidInput.x;

@@ -99,0 +99,0 @@ var deltaY = input.y - _lastValidInput.y;

@@ -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<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;
"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 s=p.stage,c=p.startInput;return e.INPUT_START===s?(n=0,r=0,o=0,a=0,i=0,u=e.NONE):e.INPUT_MOVE===s&&(n=Math.round(p.points[0][e.CLIENT_X]-c.points[0][e.CLIENT_X]),r=Math.round(p.points[0][e.CLIENT_Y]-c.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.stage;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 s=p.stage;r=r||p.startInput;var c=p.timestamp-r.timestamp;if(e.INPUT_MOVE===s&&e.COMPUTE_INTERVAL<c){var d=p.x-r.x,h=p.y-r.y;i=Math.round(d/c*100)/100,u=Math.round(h/c*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;
{
"name": "@any-touch/compute",
"version": "0.7.8",
"version": "0.7.9",
"main": "dist/index.js",

@@ -14,4 +14,4 @@ "module": "dist/index.es.js",

"dependencies": {
"@any-touch/shared": "^0.7.8",
"@any-touch/vector": "^0.7.8",
"@any-touch/shared": "^0.7.9",
"@any-touch/vector": "^0.7.9",
"tslib": "^1.9.3"

@@ -22,3 +22,3 @@ },

"sideEffects": false,
"gitHead": "14f864223c9a4df212561b9a53e93a5f89217b15"
"gitHead": "4d795d9ac1c0cf597db9bc070284f3de7578e5fd"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc