Browse Source

Go back to using percentages instead of pixels

pull/993/head
ssssobek 1 year ago
parent
commit
ca180ab9ea
  1. 12
      src/components/player/atoms/settings/CaptionSettingsView.tsx
  2. 2
      src/components/player/base/SubtitleView.tsx
  3. 11
      src/pages/parts/settings/CaptionsPart.tsx
  4. 2
      src/stores/subtitles/index.ts

12
src/components/player/atoms/settings/CaptionSettingsView.tsx

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

2
src/components/player/base/SubtitleView.tsx

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

11
src/pages/parts/settings/CaptionsPart.tsx

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

2
src/stores/subtitles/index.ts

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

Loading…
Cancel
Save