Improvements on double page (#417)
* going to next chapter and prev page works now * cleaned comments * updated mapping file * changed version back * Fixed chapters being read. * fixed comments
This commit is contained in:
@@ -23,8 +23,6 @@ const isSinglePage = (index: number, spreadPages: boolean[]): boolean => {
|
|||||||
if (spreadPages[index]) return true;
|
if (spreadPages[index]) return true;
|
||||||
// Page is single if it is last page
|
// Page is single if it is last page
|
||||||
if (index === spreadPages.length - 1) return true;
|
if (index === spreadPages.length - 1) return true;
|
||||||
// Page can not be single if it is not followed by spread
|
|
||||||
if (!spreadPages[index + 1]) return false;
|
|
||||||
// Page is single if number of single pages since last spread is odd
|
// Page is single if number of single pages since last spread is odd
|
||||||
const previousSpreadIndex = spreadPages.lastIndexOf(true, index - 1);
|
const previousSpreadIndex = spreadPages.lastIndexOf(true, index - 1);
|
||||||
const numberOfNonSpreads = index - (previousSpreadIndex + 1);
|
const numberOfNonSpreads = index - (previousSpreadIndex + 1);
|
||||||
@@ -86,12 +84,7 @@ export default function DoublePagedPager(props: IReaderProps) {
|
|||||||
|
|
||||||
function pagesToGoBack() {
|
function pagesToGoBack() {
|
||||||
// If previous page is single page, go only one page pack
|
// If previous page is single page, go only one page pack
|
||||||
// If previous page is not single page, but we are on last page
|
if (isSinglePage(curPage - 1, spreadPage.current)) {
|
||||||
// go back one page anyway.
|
|
||||||
// This handles special case, where last page was displayed in pair, but then
|
|
||||||
// page was changed to the last page and now it is shown as single page.
|
|
||||||
const isLastPage = curPage === spreadPage.current.length - 1;
|
|
||||||
if (isSinglePage(curPage - 1, spreadPage.current) || isLastPage) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user