From 7c5c5daf5c72a8745eb44c2b33b12b2a5a10a04f Mon Sep 17 00:00:00 2001 From: qtchaos <72168435+qtchaos@users.noreply.github.com> Date: Mon, 11 Mar 2024 17:59:55 +0200 Subject: [PATCH] fix: add minimums & maximums for other settings --- src/stores/subtitles/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/stores/subtitles/index.ts b/src/stores/subtitles/index.ts index e7f0aa26..0d89763f 100644 --- a/src/stores/subtitles/index.ts +++ b/src/stores/subtitles/index.ts @@ -67,9 +67,15 @@ export const useSubtitleStore = create( updateStyling(newStyling) { set((s) => { if (newStyling.backgroundOpacity !== undefined) - s.styling.backgroundOpacity = newStyling.backgroundOpacity; + s.styling.backgroundOpacity = Math.min( + 1, + Math.max(0, newStyling.backgroundOpacity), + ); if (newStyling.backgroundBlur !== undefined) - s.styling.backgroundBlur = Math.min(1, newStyling.backgroundBlur); + s.styling.backgroundBlur = Math.min( + 1, + Math.max(0, newStyling.backgroundBlur), + ); if (newStyling.color !== undefined) s.styling.color = newStyling.color.toLowerCase(); if (newStyling.size !== undefined)