mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Add blurred backgroud for subtitles
This commit is contained in:
parent
9409922efd
commit
e09c04b57b
6 changed files with 39 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,18 @@ export function CaptionSettingsView({ id }: { id: string }) {
|
|||
value={styling.backgroundOpacity * 100}
|
||||
textTransformer={(s) => `${s}%`}
|
||||
/>
|
||||
<CaptionSetting
|
||||
label={t("settings.subtitles.backgroundBlurLabel")}
|
||||
max={64}
|
||||
min={0}
|
||||
onChange={(v) =>
|
||||
updateStyling({
|
||||
backgroundBlur: Math.round(v / 4) * 4,
|
||||
})
|
||||
}
|
||||
value={styling.backgroundBlur}
|
||||
textTransformer={(s) => `${s}px`}
|
||||
/>
|
||||
<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(${styling.backgroundBlur}px)`
|
||||
: "none",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
|
|
|
@ -92,6 +92,19 @@ export function CaptionsPart(props: {
|
|||
value={props.styling.backgroundOpacity * 100}
|
||||
textTransformer={(s) => `${s}%`}
|
||||
/>
|
||||
<CaptionSetting
|
||||
label={t("settings.subtitles.backgroundBlurLabel")}
|
||||
max={64}
|
||||
min={0}
|
||||
onChange={(v) =>
|
||||
props.setStyling({
|
||||
...props.styling,
|
||||
backgroundBlur: Math.round(v / 4) * 4,
|
||||
})
|
||||
}
|
||||
value={props.styling.backgroundBlur}
|
||||
textTransformer={(s) => `${s}px`}
|
||||
/>
|
||||
<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 64
|
||||
*/
|
||||
backgroundBlur: number;
|
||||
}
|
||||
|
||||
export interface SubtitleStore {
|
||||
|
@ -51,6 +56,7 @@ export const useSubtitleStore = create(
|
|||
color: "#ffffff",
|
||||
backgroundOpacity: 0.5,
|
||||
size: 1,
|
||||
backgroundBlur: 0,
|
||||
},
|
||||
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