Skip to content

Commit

Permalink
Fixed next page button miscalculating total page count
Browse files Browse the repository at this point in the history
  • Loading branch information
fuj1n committed Mar 22, 2019
1 parent 8404084 commit 3abd11c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public void updateScreen() {
super.updateScreen();

previousArrow.visible = page != -1;
nextArrow.visible = page < book.getFullPageCount(advancementCache) - (book.getPageCount(advancementCache) % 2 != 0 ? 0 : 1);
nextArrow.visible = page + 1 < book.getFullPageCount(advancementCache);
backArrow.visible = oldPage >= -1;

if(page == -1) {
Expand Down Expand Up @@ -470,7 +470,7 @@ public void actionPerformed(GuiButton button) {
} else if(button == nextArrow) {
page++;
int fullPageCount = book.getFullPageCount(advancementCache);
if(page > fullPageCount - (fullPageCount % 2 != 0 ? 0 : 1)) {
if(page >= fullPageCount) {
page = fullPageCount - 1;
}
} else if(button == backArrow) {
Expand Down

0 comments on commit 3abd11c

Please sign in to comment.