Improve var/func naming

This commit is contained in:
schroda
2026-06-04 15:36:09 +02:00
parent ad7e7f1771
commit 848753022a

View File

@@ -131,11 +131,11 @@ const BaseReaderViewer = ({
}, [scrollbarXSize, scrollbarYSize]);
const imageRefs = useRef<(HTMLElement | null)[]>(pages.map(() => null));
const [{ minChapterViewWidth, minChapterViewHeight, minChapterSizeSourceChapterId }, setChapterViewerSize] =
const [{ minChapterViewerWidth, minChapterViewerHeight, minChapterViewerSourceChapterId }, setChapterViewerSize] =
useState({
minChapterViewWidth: 0,
minChapterViewHeight: 0,
minChapterSizeSourceChapterId: -1,
minChapterViewerWidth: 0,
minChapterViewerHeight: 0,
minChapterViewerSourceChapterId: -1,
});
const [, setTriggerReRender] = useState({});
@@ -159,41 +159,41 @@ const BaseReaderViewer = ({
[currentChapter, chaptersToRender],
);
const onChapterViewSizeChange = useCallback(
const onChapterViewerSizeChange = useCallback(
(width: number, height: number, chapterId: ChapterIdInfo['id']) => {
if (!isContinuousReadingModeActive) {
return;
}
const isSameChapterId = chapterId === minChapterSizeSourceChapterId;
const isSameChapterId = chapterId === minChapterViewerSourceChapterId;
if (isContinuousVerticalReadingModeActive) {
if (!isSameChapterId && minChapterViewWidth >= width) {
if (!isSameChapterId && minChapterViewerWidth >= width) {
return;
}
setChapterViewerSize({
minChapterViewWidth: width,
minChapterViewHeight: 0,
minChapterSizeSourceChapterId: chapterId,
minChapterViewerWidth: width,
minChapterViewerHeight: 0,
minChapterViewerSourceChapterId: chapterId,
});
return;
}
if (isSameChapterId || minChapterViewHeight < height) {
if (isSameChapterId || minChapterViewerHeight < height) {
setChapterViewerSize({
minChapterViewWidth: 0,
minChapterViewHeight: height,
minChapterSizeSourceChapterId: chapterId,
minChapterViewerWidth: 0,
minChapterViewerHeight: height,
minChapterViewerSourceChapterId: chapterId,
});
}
},
[
isContinuousReadingModeActive,
isContinuousVerticalReadingModeActive,
minChapterViewWidth,
minChapterViewHeight,
minChapterSizeSourceChapterId,
minChapterViewerWidth,
minChapterViewerHeight,
minChapterViewerSourceChapterId,
],
);
@@ -234,9 +234,9 @@ const BaseReaderViewer = ({
useLayoutEffect(() => {
setChapterViewerSize({
minChapterViewWidth: 0,
minChapterViewHeight: 0,
minChapterSizeSourceChapterId: -1,
minChapterViewerWidth: 0,
minChapterViewerHeight: 0,
minChapterViewerSourceChapterId: -1,
});
setTriggerReRender({});
}, [readingMode]);
@@ -287,6 +287,8 @@ const BaseReaderViewer = ({
const nextChapter =
chaptersToRender[chapterIndex - 1] ?? chapters[initialChapterIndex - visibleChapters.trailing - 1];
const isChapterViewerSourceChapter = chapter.id === minChapterViewerSourceChapterId;
const isInitialChapter = chapter.id === initialChapter.id;
const isCurrentChapter = chapter.id === currentChapter.id;
const isPreviousChapter = chapter.id === chaptersToRender[currentChapterIndex + 1]?.id;
@@ -308,8 +310,6 @@ const BaseReaderViewer = ({
visibleChapters,
);
const isChapterSizeSourceChapter = chapter.id === minChapterSizeSourceChapterId;
const currentChapterCurrentPageIndex = isAdjacentChapterToCurrentChapter
? getReaderChapterViewerCurrentPageIndex(
currentPageIndex,
@@ -384,9 +384,9 @@ const BaseReaderViewer = ({
customFilter={customFilter}
shouldStretchPage={shouldStretchPage}
readerNavBarWidth={readerNavBarWidth}
onSizeChange={onChapterViewSizeChange}
minWidth={isChapterSizeSourceChapter ? 0 : minChapterViewWidth}
minHeight={isChapterSizeSourceChapter ? 0 : minChapterViewHeight}
onSizeChange={onChapterViewerSizeChange}
minWidth={isChapterViewerSourceChapter ? 0 : minChapterViewerWidth}
minHeight={isChapterViewerSourceChapter ? 0 : minChapterViewerHeight}
scrollElement={scrollElementRef.current}
/>
);