1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2025-01-01 16:37:39 +01:00

Go back to using percentages instead of pixels

This commit is contained in:
ssssobek 2024-03-10 23:10:25 +01:00
parent e09c04b57b
commit ca180ab9ea
4 changed files with 10 additions and 17 deletions

View file

@ -264,15 +264,11 @@ export function CaptionSettingsView({ id }: { id: string }) {
/> />
<CaptionSetting <CaptionSetting
label={t("settings.subtitles.backgroundBlurLabel")} label={t("settings.subtitles.backgroundBlurLabel")}
max={64} max={100}
min={0} min={0}
onChange={(v) => onChange={(v) => updateStyling({ backgroundBlur: v / 100 })}
updateStyling({ value={styling.backgroundBlur * 100}
backgroundBlur: Math.round(v / 4) * 4, textTransformer={(s) => `${s}%`}
})
}
value={styling.backgroundBlur}
textTransformer={(s) => `${s}px`}
/> />
<CaptionSetting <CaptionSetting
label={t("settings.subtitles.textSizeLabel")} label={t("settings.subtitles.textSizeLabel")}

View file

@ -57,7 +57,7 @@ export function CaptionCue({
backgroundColor: `rgba(0,0,0,${styling.backgroundOpacity.toFixed(2)})`, backgroundColor: `rgba(0,0,0,${styling.backgroundOpacity.toFixed(2)})`,
backdropFilter: backdropFilter:
styling.backgroundBlur !== 0 styling.backgroundBlur !== 0
? `blur(${styling.backgroundBlur}px)` ? `blur(${Math.floor(styling.backgroundBlur * 64)}px)`
: "none", : "none",
}} }}
> >

View file

@ -94,16 +94,13 @@ export function CaptionsPart(props: {
/> />
<CaptionSetting <CaptionSetting
label={t("settings.subtitles.backgroundBlurLabel")} label={t("settings.subtitles.backgroundBlurLabel")}
max={64} max={100}
min={0} min={0}
onChange={(v) => onChange={(v) =>
props.setStyling({ props.setStyling({ ...props.styling, backgroundBlur: v / 100 })
...props.styling,
backgroundBlur: Math.round(v / 4) * 4,
})
} }
value={props.styling.backgroundBlur} value={props.styling.backgroundBlur * 100}
textTransformer={(s) => `${s}px`} textTransformer={(s) => `${s}%`}
/> />
<CaptionSetting <CaptionSetting
label={t("settings.subtitles.textSizeLabel")} label={t("settings.subtitles.textSizeLabel")}

View file

@ -19,7 +19,7 @@ export interface SubtitleStyling {
backgroundOpacity: number; backgroundOpacity: number;
/** /**
* background blur, ranges between 0 and 64 * background blur, ranges between 0 and 1
*/ */
backgroundBlur: number; backgroundBlur: number;
} }