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