UNPKG

742 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports["default"] = void 0;
7var _default = {
8 getPosition: function getPosition(value, min, max) {
9 var minv = Math.log(min);
10 var maxv = Math.log(max);
11 var scale = (maxv - minv) / 100;
12 return (Math.log(value) - minv) / scale;
13 },
14 getValue: function getValue(positionPercent, min, max) {
15 var minv = Math.log(min);
16 var maxv = Math.log(max);
17
18 if (positionPercent === 0) {
19 return min;
20 }
21
22 if (positionPercent === 100) {
23 return max;
24 } // calculate adjustment factor
25
26
27 var scale = (maxv - minv) / 100;
28 return Math.floor(Math.exp(minv + scale * positionPercent)) || 0;
29 }
30};
31exports["default"] = _default;
\No newline at end of file