diff --git a/components/PageViewWrapper.tsx b/components/PageViewWrapper.tsx index befe83c..8025844 100644 --- a/components/PageViewWrapper.tsx +++ b/components/PageViewWrapper.tsx @@ -10,7 +10,7 @@ interface Props { pageView: PageView, zoom: number, floatingPage: FloatingPageSettings, - wrapper: (ref: React.Ref, width: (dimensions: Dimensions) => string, alignSelf: string) => JSX.Element, + wrapper: (ref: React.Ref, alignSelf: string, imageDivWidth: (dimensions: Dimensions) => string, imageWidth: string | undefined) => JSX.Element, } export type PageViewWrapperHandle = { @@ -62,7 +62,7 @@ export const PageViewWrapper = forwardRef(function switch (pageView) { case PageView.Fixed: - return wrapper(divRef, (dimensions) => Math.round(dimensions.w * zoom / 100) + "px", "center") + return wrapper(divRef, "center", (dimensions) => Math.round(dimensions.w * zoom / 100) + "px", "100%") case PageView.Floating: return (function ref={transformRef} > - {wrapper(divRef, () => "auto", "stretch")} + {wrapper(divRef, "stretch", () => "auto", undefined)} } diff --git a/pages/read/[bookId]/[page].tsx b/pages/read/[bookId]/[page].tsx index 8114765..8a217f3 100644 --- a/pages/read/[bookId]/[page].tsx +++ b/pages/read/[bookId]/[page].tsx @@ -27,7 +27,7 @@ import {FloatingPageSettings} from "../../../model/AppSettings" import {useImmer} from "use-immer" import {MdSettingsBackupRestore} from "react-icons/md" import {TOOLTIP_OPEN_DELAY} from "../../../util/Util" -import {calculatePageStep, calculateWantedPages} from "../../../util/Pages" +import {calculatePageStep, calculateWantedPages, isCurrentPageCoverOrOnePageDisplay} from "../../../util/Pages" import {ReaderPage} from "../../../model/ReaderPage" import {ReadingDirection} from "../../../model/ReadingDirection" import {PageDisplay} from "../../../model/PageDisplay" @@ -101,6 +101,9 @@ export default function ReadBookPage( if (reloadRequired) { setReloadRequired(false) await pushRouterPage(lowPage + 1) + if (isCurrentPageCoverOrOnePageDisplay(lowPage, readerSettings.pageDisplay)) { + pageViewWrapperRef.current?.pageTurned() + } } }, 300) return () => clearTimeout(timer) @@ -255,16 +258,16 @@ export default function ReadBookPage( zoom={readerSettings.zoom} floatingPage={floatingPage} ref={pageViewWrapperRef} - wrapper={(divRef, width, alignSelf) => + wrapper={(divRef, alignSelf, imageDivWidth, imageWidth) => {pages.map((page, index) => { return