Skip to content

Commit 64f6e98

Browse files
committed
[Feature] disable pagenavigation mobile pan zoom (#9232)
(master → master)
1 parent 9fbfa09 commit 64f6e98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/helpers/TouchEventManager.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ const TouchEventManager = {
256256
const isStylusModeDisabled = !docViewer.isStylusModeEnabled();
257257
const isUsingAnnotationToolsAndStylusIsDisabled = this.isUsingAnnotationTools() && isStylusModeDisabled;
258258
const isUsingPenAndStylusEnabled = this.isUsingPen() && !isStylusModeDisabled;
259+
const { container, document: doc } = this;
259260

260261
if (
261262
!this.allowSwipe ||
@@ -283,8 +284,9 @@ const TouchEventManager = {
283284
const isFirstPage = currentPage === 1;
284285
const isLastPage = currentPage === totalPages;
285286
const isSingleDisplayMode = !core.isContinuousDisplayMode();
286-
const shouldGoToPrevPage = isSingleDisplayMode && !isFirstPage && ((swipedToLeft && this.allowHorizontalSwipe) || (swipedToTop && this.allowVerticalSwipe));
287-
const shouldGoToNextPage = isSingleDisplayMode && !isLastPage && ((swipedToRight && this.allowHorizontalSwipe) || (swipedToBottom && this.allowVerticalSwipe));
287+
const doesPagesFitOnScreen = doc.clientWidth < container.clientWidth || doc.clientHeight < container.clientHeight;
288+
const shouldGoToPrevPage = isSingleDisplayMode && !isFirstPage && ((swipedToLeft && this.allowHorizontalSwipe) || (swipedToTop && this.allowVerticalSwipe)) && doesPagesFitOnScreen;
289+
const shouldGoToNextPage = isSingleDisplayMode && !isLastPage && ((swipedToRight && this.allowHorizontalSwipe) || (swipedToBottom && this.allowVerticalSwipe)) && doesPagesFitOnScreen;
288290

289291
if (shouldGoToPrevPage) {
290292
core.setCurrentPage(Math.max(1, currentPage - numberOfPagesToNavigate));

0 commit comments

Comments
 (0)