diff --git a/website/src/repl/components/panel/SettingsTab.jsx b/website/src/repl/components/panel/SettingsTab.jsx index e326a7b3e..e78903e56 100644 --- a/website/src/repl/components/panel/SettingsTab.jsx +++ b/website/src/repl/components/panel/SettingsTab.jsx @@ -32,7 +32,7 @@ function SelectInput({ value, options, onChange }) { ); } -function NumberSlider({ value, onChange, step = 1, ...rest }) { +function NumberSlider({ value, onChange, min, max, step = 1, ...rest }) { const fractionalDigits = useMemo(() => { const stepStr = step.toString(); const decimalPointIdx = stepStr.indexOf('.'); @@ -43,22 +43,36 @@ function NumberSlider({ value, onChange, step = 1, ...rest }) { return stepStr.slice(decimalPointIdx + 1).length; }, [step]); + const textInputCharWidth = useMemo(() => { + const maxValueWholePartLength = Math.floor(max).toString().length; + return maxValueWholePartLength + '.'.length + fractionalDigits; + }, [max, fractionalDigits]); + return (