mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Merge pull request #993 from ssssobek/dev
Add blurred background option for subtitles
This commit is contained in:
commit
3d333dcb03
6 changed files with 32 additions and 0 deletions
|
@ -533,6 +533,7 @@
|
|||
},
|
||||
"subtitles": {
|
||||
"backgroundLabel": "Background opacity",
|
||||
"backgroundBlurLabel": "Background blur",
|
||||
"colorLabel": "Color",
|
||||
"previewQuote": "I must not fear. Fear is the mind-killer.",
|
||||
"textSizeLabel": "Text size",
|
||||
|
|
|
@ -525,6 +525,7 @@
|
|||
},
|
||||
"subtitles": {
|
||||
"backgroundLabel": "Krycie tła",
|
||||
"backgroundBlurLabel": "Rozmycie tła",
|
||||
"colorLabel": "Kolor",
|
||||
"previewQuote": "Nie wolno mi się bać. Strach zabija myślenie.",
|
||||
"textSizeLabel": "Rozmiar czcionki",
|
||||
|
|
|
@ -262,6 +262,14 @@ export function CaptionSettingsView({ id }: { id: string }) {
|
|||
value={styling.backgroundOpacity * 100}
|
||||
textTransformer={(s) => `${s}%`}
|
||||
/>
|
||||
<CaptionSetting
|
||||
label={t("settings.subtitles.backgroundBlurLabel")}
|
||||
max={100}
|
||||
min={0}
|
||||
onChange={(v) => updateStyling({ backgroundBlur: v / 100 })}
|
||||
value={styling.backgroundBlur * 100}
|
||||
textTransformer={(s) => `${s}%`}
|
||||
/>
|
||||
<CaptionSetting
|
||||
label={t("settings.subtitles.textSizeLabel")}
|
||||
max={200}
|
||||
|
|
|
@ -55,6 +55,10 @@ export function CaptionCue({
|
|||
color: styling.color,
|
||||
fontSize: `${(1.5 * styling.size).toFixed(2)}em`,
|
||||
backgroundColor: `rgba(0,0,0,${styling.backgroundOpacity.toFixed(2)})`,
|
||||
backdropFilter:
|
||||
styling.backgroundBlur !== 0
|
||||
? `blur(${Math.floor(styling.backgroundBlur * 64)}px)`
|
||||
: "none",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
|
|
|
@ -92,6 +92,16 @@ export function CaptionsPart(props: {
|
|||
value={props.styling.backgroundOpacity * 100}
|
||||
textTransformer={(s) => `${s}%`}
|
||||
/>
|
||||
<CaptionSetting
|
||||
label={t("settings.subtitles.backgroundBlurLabel")}
|
||||
max={100}
|
||||
min={0}
|
||||
onChange={(v) =>
|
||||
props.setStyling({ ...props.styling, backgroundBlur: v / 100 })
|
||||
}
|
||||
value={props.styling.backgroundBlur * 100}
|
||||
textTransformer={(s) => `${s}%`}
|
||||
/>
|
||||
<CaptionSetting
|
||||
label={t("settings.subtitles.textSizeLabel")}
|
||||
max={200}
|
||||
|
|
|
@ -17,6 +17,11 @@ export interface SubtitleStyling {
|
|||
* background opacity, ranges between 0 and 1
|
||||
*/
|
||||
backgroundOpacity: number;
|
||||
|
||||
/**
|
||||
* background blur, ranges between 0 and 1
|
||||
*/
|
||||
backgroundBlur: number;
|
||||
}
|
||||
|
||||
export interface SubtitleStore {
|
||||
|
@ -51,6 +56,7 @@ export const useSubtitleStore = create(
|
|||
color: "#ffffff",
|
||||
backgroundOpacity: 0.5,
|
||||
size: 1,
|
||||
backgroundBlur: 0.5,
|
||||
},
|
||||
resetSubtitleSpecificSettings() {
|
||||
set((s) => {
|
||||
|
@ -62,6 +68,8 @@ export const useSubtitleStore = create(
|
|||
set((s) => {
|
||||
if (newStyling.backgroundOpacity !== undefined)
|
||||
s.styling.backgroundOpacity = newStyling.backgroundOpacity;
|
||||
if (newStyling.backgroundBlur !== undefined)
|
||||
s.styling.backgroundBlur = newStyling.backgroundBlur;
|
||||
if (newStyling.color !== undefined)
|
||||
s.styling.color = newStyling.color.toLowerCase();
|
||||
if (newStyling.size !== undefined)
|
||||
|
|
Loading…
Reference in a new issue