@any-touch/vector
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -0,1 +1,2 @@ | ||
declare const _default: (x: number, y: number) => any; | ||
/** | ||
@@ -6,2 +7,2 @@ * 计算点相对于(0,0)的方向 | ||
*/ | ||
export default function (x: number, y: number): any; | ||
export default _default; |
@@ -1,2 +0,2 @@ | ||
import { DIRECTION } from '@any-touch/shared'; | ||
import { NONE, DIRECTION_RIGHT, DIRECTION_LEFT, DIRECTION_DOWN, DIRECTION_UP } from '@any-touch/shared'; | ||
@@ -35,11 +35,14 @@ var getVLength = (function (v) { | ||
function getDirection (x, y) { | ||
if (Math.abs(x) > Math.abs(y)) { | ||
return 0 < x ? DIRECTION.RIGHT : DIRECTION.LEFT; | ||
var getDirection = (function (x, y) { | ||
if (x === y) { | ||
return NONE; | ||
} | ||
else if (Math.abs(x) < Math.abs(y)) { | ||
return 0 < y ? DIRECTION.DOWN : DIRECTION.UP; | ||
else if (Math.abs(x) > Math.abs(y)) { | ||
return 0 < x ? DIRECTION_RIGHT : DIRECTION_LEFT; | ||
} | ||
} | ||
else { | ||
return 0 < y ? DIRECTION_DOWN : DIRECTION_UP; | ||
} | ||
}); | ||
export { getAngle, getCross, getDirection, getDotProduct, getRadian, getVLength, radianToAngle }; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@any-touch/shared"),r=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e=function(t,r){return t.x*r.x+t.y*r.y},n=function(t,n){var o=r(t)*r(n);if(0===o)return 0;var a=e(t,n)/o;return a>1&&(a=1),Math.acos(a)},o=function(t,r){return t.x*r.y-r.x*t.y},a=function(t){return t/Math.PI*180};exports.getAngle=function(t,r){var e=n(t,r);return o(t,r)>0&&(e*=-1),a(e)},exports.getCross=o,exports.getDirection=function(r,e){return Math.abs(r)>Math.abs(e)?0<r?t.DIRECTION.RIGHT:t.DIRECTION.LEFT:Math.abs(r)<Math.abs(e)?0<e?t.DIRECTION.DOWN:t.DIRECTION.UP:void 0},exports.getDotProduct=e,exports.getRadian=n,exports.getVLength=r,exports.radianToAngle=a; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@any-touch/shared"),r=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e=function(t,r){return t.x*r.x+t.y*r.y},n=function(t,n){var o=r(t)*r(n);if(0===o)return 0;var u=e(t,n)/o;return u>1&&(u=1),Math.acos(u)},o=function(t,r){return t.x*r.y-r.x*t.y},u=function(t){return t/Math.PI*180};exports.getAngle=function(t,r){var e=n(t,r);return o(t,r)>0&&(e*=-1),u(e)},exports.getCross=o,exports.getDirection=function(r,e){return r===e?t.NONE:Math.abs(r)>Math.abs(e)?0<r?t.DIRECTION_RIGHT:t.DIRECTION_LEFT:0<e?t.DIRECTION_DOWN:t.DIRECTION_UP},exports.getDotProduct=e,exports.getRadian=n,exports.getVLength=r,exports.radianToAngle=u; |
{ | ||
"name": "@any-touch/vector", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "any-touch中向量计算相关的函数.", | ||
@@ -10,4 +10,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@any-touch/shared": "^1.0.4", | ||
"tslib": "^2.0.1" | ||
"@any-touch/shared": "^1.0.5", | ||
"tslib": "^1.9.3" | ||
}, | ||
@@ -21,3 +21,3 @@ "publishConfig": { | ||
"sideEffects": false, | ||
"gitHead": "bf4837c370cf89353eff7911b7d2c772198fa301" | ||
"gitHead": "bf4d9191714dd0852ca76a335d5a232af36a691e" | ||
} |
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
5075
95
+ Addedtslib@1.14.1(transitive)
- Removedtslib@2.8.1(transitive)
Updated@any-touch/shared@^1.0.5
Updatedtslib@^1.9.3