@lijuhong1981/jsmath 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/Range.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lijuhong1981/jsmath",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/lijuhong1981/jsmath#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@lijuhong1981/jscheck": "^1.0.
|
|
22
|
+
"@lijuhong1981/jscheck": "^1.0.4"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/src/Range.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Check from "@lijuhong1981/jscheck";
|
|
2
2
|
import isBetween from "./isBetween.js";
|
|
3
3
|
import lerp from "./lerp.js";
|
|
4
|
-
import
|
|
4
|
+
import scalarInRange from "./scalarInRange.js";
|
|
5
5
|
|
|
6
6
|
function checkMinMaxValue(range) {
|
|
7
7
|
if (range.minimum > range.maximum) {
|
|
@@ -100,13 +100,13 @@ class Range {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* 计算一个数值在当前区间内的线性插值标量
|
|
104
104
|
* @param {Number} value 需要计算的数值
|
|
105
105
|
* @param {Boolean} needClamp 是否需要约束至0到1之间,默认true
|
|
106
|
-
* @returns {Number}
|
|
106
|
+
* @returns {Number} 插值标量
|
|
107
107
|
*/
|
|
108
|
-
|
|
109
|
-
return
|
|
108
|
+
scalar(value, needClamp = true) {
|
|
109
|
+
return scalarInRange(value, this.minimum, this.maximum, needClamp);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|