@any-touch/compute
Advanced tools
Comparing version 0.6.0-beta.9 to 0.6.0-beta.11
@@ -7,12 +7,10 @@ 'use strict'; | ||
var getAngle = _interopDefault(require('@any-touch/vector/getAngle')); | ||
var radianToAngle = _interopDefault(require('@any-touch/vector/radianToAngle')); | ||
var vector = require('@any-touch/vector'); | ||
var shared = require('@any-touch/shared'); | ||
var getVLength = _interopDefault(require('@any-touch/vector/getVLength')); | ||
var getDirection = _interopDefault(require('@any-touch/vector/getDirection')); | ||
function computeAngle(_a) { | ||
var startV = _a.startV, prevV = _a.prevV, activeV = _a.activeV; | ||
var deltaAngle = getAngle(activeV, prevV); | ||
var angle = getAngle(activeV, startV); | ||
var deltaAngle = vector.getAngle(activeV, prevV); | ||
var angle = vector.getAngle(activeV, startV); | ||
return { angle: angle, deltaAngle: deltaAngle }; | ||
@@ -34,3 +32,3 @@ } | ||
var deltaXY = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); | ||
deltaXYAngle = Math.round(radianToAngle(Math.acos(Math.abs(deltaX) / deltaXY))); | ||
deltaXYAngle = Math.round(vector.radianToAngle(Math.acos(Math.abs(deltaX) / deltaXY))); | ||
} | ||
@@ -67,4 +65,4 @@ } | ||
this.distanceY = Math.abs(this.displacementY); | ||
this.distance = Math.round(getVLength({ x: this.distanceX, y: this.distanceY })); | ||
this.overallDirection = getDirection(this.displacementX, this.displacementY); | ||
this.distance = Math.round(vector.getVLength({ x: this.distanceX, y: this.distanceY })); | ||
this.overallDirection = vector.getDirection(this.displacementX, this.displacementY); | ||
} | ||
@@ -119,3 +117,3 @@ var _a = this, displacementX = _a.displacementX, displacementY = _a.displacementY, distanceX = _a.distanceX, distanceY = _a.distanceY, distance = _a.distance, overallDirection = _a.overallDirection; | ||
this.velocityY = Math.abs(this.speedY); | ||
this.direction = getDirection(deltaX, deltaY) || (this.direction); | ||
this.direction = vector.getDirection(deltaX, deltaY) || (this.direction); | ||
this._lastValidInput = input; | ||
@@ -122,0 +120,0 @@ } |
{ | ||
"name": "@any-touch/compute", | ||
"version": "0.6.0-beta.9", | ||
"version": "0.6.0-beta.11", | ||
"main": "dist/index.js", | ||
@@ -12,3 +12,3 @@ "module": "dist/index.es.js", | ||
"license": "ISC", | ||
"gitHead": "07f846a6fe86b0b3a69ee4d8988dd6d9771d7659" | ||
"gitHead": "85e41ecb437b2c532f098cdc73f95dcf066473cd" | ||
} |
import { Vector } from '@any-touch/shared/types'; | ||
import getAngle from '@any-touch/vector/getAngle'; | ||
import {getAngle} from '@any-touch/vector'; | ||
export default function computeAngle({ | ||
@@ -4,0 +4,0 @@ startV, prevV, activeV |
@@ -1,2 +0,2 @@ | ||
import radianToAngle from '@any-touch/vector/radianToAngle'; | ||
import {radianToAngle} from '@any-touch/vector'; | ||
import { Input } from '@any-touch/shared/types'; | ||
@@ -3,0 +3,0 @@ |
@@ -5,4 +5,4 @@ | ||
import { NONE } from '@any-touch/shared'; | ||
import getVLength from '@any-touch/vector/getVLength'; | ||
import getDirection from '@any-touch/vector/getDirection'; | ||
import {getVLength} from '@any-touch/vector'; | ||
import {getDirection} from '@any-touch/vector'; | ||
@@ -9,0 +9,0 @@ |
@@ -7,3 +7,3 @@ // 返回最近一个时间段的计算结果 | ||
import {INPUT_MOVE,COMPUTE_INTERVAL } from '@any-touch/shared'; | ||
import getDirection from '@any-touch/vector/getDirection'; | ||
import {getDirection} from '@any-touch/vector'; | ||
export default class ComputeVAndDir { | ||
@@ -10,0 +10,0 @@ velocityX = 0; |
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
24476
521