Add "cycle reading mode" hotkey

This commit is contained in:
schroda
2024-12-17 16:23:09 +01:00
parent 0771eabfcf
commit ce15e4db70
5 changed files with 22 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ import { getNextRotationValue } from '@/modules/core/utils/ValueRotationButton.u
import {
READER_PAGE_SCALE_MODE_VALUES,
ReaderScrollAmount,
READING_MODE_VALUES,
} from '@/modules/reader/constants/ReaderSettings.constants.tsx';
import { useReaderStateMangaContext } from '@/modules/reader/contexts/state/ReaderStateMangaContext.tsx';
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
@@ -146,7 +147,7 @@ export const ReaderHotkeys = ({
true,
);
},
[updateSetting, deleteSetting, pageScaleMode],
[updateSetting, deleteSetting, pageScaleMode.value, pageScaleMode.isDefault],
);
useHotkeys(
hotkeys[ReaderHotkey.STRETCH_IMAGE],
@@ -158,6 +159,21 @@ export const ReaderHotkeys = ({
() => updateSetting('shouldOffsetDoubleSpreads', !shouldOffsetDoubleSpreads.value),
[updateSetting, shouldOffsetDoubleSpreads.value],
);
useHotkeys(
hotkeys[ReaderHotkey.CYCLE_READING_MODE],
() => {
updateSettingCycleThrough(
updateSetting,
deleteSetting,
'readingMode',
readingMode.value,
READING_MODE_VALUES,
readingMode.isDefault,
true,
);
},
[updateSetting, deleteSetting, readingMode.value, readingMode.isDefault],
);
useEffect(() => {
enableScope(HotkeyScope.READER);

View File

@@ -31,6 +31,7 @@ const READER_HOTKEY_TO_TITLE: Record<ReaderHotkey, TranslationKey> = {
[ReaderHotkey.CYCLE_SCALE_TYPE]: 'reader.settings.hotkey.scale_type',
[ReaderHotkey.STRETCH_IMAGE]: 'reader.settings.hotkey.stretch_image',
[ReaderHotkey.OFFSET_SPREAD_PAGES]: 'reader.settings.hotkey.offset_spread_pages',
[ReaderHotkey.CYCLE_READING_MODE]: 'reader.settings.hotkey.reading_mode',
};
export const ReaderSettingHotkey = ({

View File

@@ -119,6 +119,7 @@ export const DEFAULT_READER_SETTINGS: IReaderSettings = {
[ReaderHotkey.CYCLE_SCALE_TYPE]: ['i'],
[ReaderHotkey.STRETCH_IMAGE]: ['f'],
[ReaderHotkey.OFFSET_SPREAD_PAGES]: ['o'],
[ReaderHotkey.CYCLE_READING_MODE]: ['r'],
},
imagePreLoadAmount: 5,
};

View File

@@ -204,6 +204,7 @@ export enum ReaderHotkey {
CYCLE_SCALE_TYPE,
STRETCH_IMAGE,
OFFSET_SPREAD_PAGES,
CYCLE_READING_MODE,
}
export interface ReaderPagerProps