Skip to content

Commit

Permalink
Enforce valid range for font size multiplier to ensure usability
Browse files Browse the repository at this point in the history
  • Loading branch information
lmg-anon authored Aug 31, 2024
1 parent 6a22dde commit 537887d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mikupad.html
Original file line number Diff line number Diff line change
Expand Up @@ -1932,10 +1932,12 @@
}
}

function InputSlider({ label, value, min = 0, max = 100, step = 1, readOnly, onValueChange, ...props }) {
function InputSlider({ label, value, min = 0, max = 100, step = 1, readOnly, strict, onValueChange, ...props }) {
const handleChange = (newValue) => {
//if (newValue < min) newValue = min;
//if (newValue > max) newValue = max;
if (strict) {
if (newValue < min) newValue = min;
if (newValue > max) newValue = max;
}
onValueChange(newValue);
};

Expand Down Expand Up @@ -6152,7 +6154,7 @@
<${EditorPreferencesModal}
isOpen=${modalState.prompt}
closeModal=${() => closeModal("prompt")}>
<${InputSlider} label="Font size multiplier" min="0.5" max="5" step="0.01"
<${InputSlider} label="Font size multiplier" min="0.5" max="5" step="0.01" strict="1"
value=${fontSizeMultiplier} onValueChange=${setFontSizeMultiplier}/>
<${Checkbox} label="Enable spell checking"
value=${spellCheck} onValueChange=${setSpellCheck}/>
Expand Down

0 comments on commit 537887d

Please sign in to comment.