mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Reset caption specific settings
Co-authored-by: William Oldham <github@binaryoverload.co.uk>
This commit is contained in:
parent
e7d6f4559e
commit
8015ec5a92
2 changed files with 12 additions and 1 deletions
|
@ -7,6 +7,9 @@ import { useSubtitleStore } from "@/stores/subtitles";
|
|||
export function useCaptions() {
|
||||
const setLanguage = useSubtitleStore((s) => s.setLanguage);
|
||||
const enabled = useSubtitleStore((s) => s.enabled);
|
||||
const resetSubtitleSpecificSettings = useSubtitleStore(
|
||||
(s) => s.resetSubtitleSpecificSettings
|
||||
);
|
||||
const setCaption = usePlayerStore((s) => s.setCaption);
|
||||
const lastSelectedLanguage = useSubtitleStore((s) => s.lastSelectedLanguage);
|
||||
const captionList = usePlayerStore((s) => s.captionList);
|
||||
|
@ -21,9 +24,10 @@ export function useCaptions() {
|
|||
srtData,
|
||||
url: caption.url,
|
||||
});
|
||||
resetSubtitleSpecificSettings();
|
||||
setLanguage(language);
|
||||
},
|
||||
[setLanguage, captionList, setCaption]
|
||||
[setLanguage, captionList, setCaption, resetSubtitleSpecificSettings]
|
||||
);
|
||||
|
||||
const disable = useCallback(async () => {
|
||||
|
|
|
@ -34,6 +34,7 @@ export interface SubtitleStore {
|
|||
setOverrideCasing(enabled: boolean): void;
|
||||
setDelay(delay: number): void;
|
||||
importSubtitleLanguage(lang: string | null): void;
|
||||
resetSubtitleSpecificSettings(): void;
|
||||
}
|
||||
|
||||
export const useSubtitleStore = create(
|
||||
|
@ -51,6 +52,12 @@ export const useSubtitleStore = create(
|
|||
backgroundOpacity: 0.5,
|
||||
size: 1,
|
||||
},
|
||||
resetSubtitleSpecificSettings() {
|
||||
set((s) => {
|
||||
s.delay = 0;
|
||||
s.overrideCasing = false;
|
||||
});
|
||||
},
|
||||
updateStyling(newStyling) {
|
||||
set((s) => {
|
||||
if (newStyling.backgroundOpacity !== undefined)
|
||||
|
|
Loading…
Reference in a new issue