From 3f2d5cfcc3fed2832e8e9a52e68eba5b10a8d117 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 7 Jun 2017 17:10:45 +0200 Subject: [PATCH] Prevent console errors when clicking to change page while in Presentation Mode (issue 8498) The click handler used in Presentation Mode didn't check if the first/last page was already reached, which after PR 7529 now causes an unnecessary console error. Hence we should simply use the already existing `_goToPreviousPage`/`_goToNextPage` methods instead, since they do the necessary bounds checking. Fixes 8498. --- web/pdf_presentation_mode.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/pdf_presentation_mode.js b/web/pdf_presentation_mode.js index 9b29bd5d34f0e..5a60c130340f1 100644 --- a/web/pdf_presentation_mode.js +++ b/web/pdf_presentation_mode.js @@ -288,7 +288,12 @@ class PDFPresentationMode { if (!isInternalLink) { // Unless an internal link was clicked, advance one page. evt.preventDefault(); - this.pdfViewer.currentPageNumber += (evt.shiftKey ? -1 : 1); + + if (evt.shiftKey) { + this._goToPreviousPage(); + } else { + this._goToNextPage(); + } } } }