Browse Source

fix: add minimums & maximums for other settings

pull/999/head
qtchaos 1 year ago
parent
commit
7c5c5daf5c
No known key found for this signature in database
GPG Key ID: 7DA98B2B9EF06A90
  1. 10
      src/stores/subtitles/index.ts

10
src/stores/subtitles/index.ts

@ -67,9 +67,15 @@ export const useSubtitleStore = create(
updateStyling(newStyling) { updateStyling(newStyling) {
set((s) => { set((s) => {
if (newStyling.backgroundOpacity !== undefined) if (newStyling.backgroundOpacity !== undefined)
s.styling.backgroundOpacity = newStyling.backgroundOpacity; s.styling.backgroundOpacity = Math.min(
1,
Math.max(0, newStyling.backgroundOpacity),
);
if (newStyling.backgroundBlur !== undefined) 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) if (newStyling.color !== undefined)
s.styling.color = newStyling.color.toLowerCase(); s.styling.color = newStyling.color.toLowerCase();
if (newStyling.size !== undefined) if (newStyling.size !== undefined)

Loading…
Cancel
Save