@ledvance/base 1.1.20 → 1.1.21
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 +1 -1
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.ts +4 -0
package/package.json
CHANGED
package/src/utils/index.d.ts
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -170,3 +170,7 @@ export function mapFloatToRange(value: number, min: number, max: number): number
|
|
|
170
170
|
// 计算插值后的值
|
|
171
171
|
return min + value * (max - min)
|
|
172
172
|
}
|
|
173
|
+
|
|
174
|
+
export function mapValueToRatio(value: number, min: number, max: number): number {
|
|
175
|
+
return ((value || 0) - min) / (max - min)
|
|
176
|
+
}
|