ChapterBug // Fix jump to wrong page if chapter number if (number - 1) % pagelength = 0 (#3730)

This commit is contained in:
yoshnopa
2023-05-16 02:26:35 +02:00
committed by GitHub
parent 0069c48e7e
commit 0e199a525f

View File

@@ -466,7 +466,7 @@ export const LightboxComponent: React.FC<IProps> = ({
function gotoPage(imageIndex: number) { function gotoPage(imageIndex: number) {
const indexInPage = (imageIndex - 1) % pageSize; const indexInPage = (imageIndex - 1) % pageSize;
if (pageCallback) { if (pageCallback) {
let jumppage = Math.floor(imageIndex / pageSize) + 1; let jumppage = Math.floor((imageIndex - 1) / pageSize) + 1;
if (page !== jumppage) { if (page !== jumppage) {
pageCallback({ page: jumppage }); pageCallback({ page: jumppage });
oldImages.current = images; oldImages.current = images;