Fix invalid step

This commit is contained in:
Piotr Rogowski 2022-10-25 21:47:57 +02:00
parent d764e83a44
commit 368adef8ae
No known key found for this signature in database
GPG Key ID: 4A842D702D9C6F8F
1 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ const SmartNumber = ({
const isSlider = (u: string) => ['%', 'C']
.includes(`${u}`.toUpperCase());
const sliderMarks: { [value: number]: string } = {};
const step = digits ? 10**-digits : 1;
sliderMarks[min] = `${min}${units}`;
if (min <= 0) {
@ -37,7 +38,7 @@ const SmartNumber = ({
value={defaultValue}
min={min}
max={max}
step={10**-digits}
step={step}
disabled={disabled}
marks={sliderMarks}
tooltip={{
@ -53,7 +54,7 @@ const SmartNumber = ({
precision={digits}
min={min}
max={max}
step={10**-digits}
step={step}
disabled={disabled}
style={{ minWidth: 150 }}
formatter={(val) => units ? `${val} ${units}` : `${val}`}