diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js index db9b233f8..41cf1be74 100644 --- a/web/text_layer_builder.js +++ b/web/text_layer_builder.js @@ -36,6 +36,7 @@ var TextLayerBuilder = function textLayerBuilder(options) { this.pageIdx = options.pageIndex; this.matches = []; this.lastScrollSource = options.lastScrollSource; + this.isViewerInPresentationMode = options.isViewerInPresentationMode; if(typeof PDFFindController === 'undefined') { window.PDFFindController = null; @@ -304,8 +305,9 @@ var TextLayerBuilder = function textLayerBuilder(options) { var isSelected = isSelectedPage && i === selectedMatchIdx; var highlightSuffix = (isSelected ? ' selected' : ''); - if (isSelected) - scrollIntoView(textDivs[begin.divIdx], {top: -50}); + if (isSelected && !this.isViewerInPresentationMode) { + scrollIntoView(textDivs[begin.divIdx], { top: -50 }); + } // Match inside new div. if (!prevEnd || begin.divIdx !== prevEnd.divIdx) { diff --git a/web/viewer.js b/web/viewer.js index b4567deba..cb0b4ef25 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1904,11 +1904,12 @@ var PageView = function pageView(container, id, scale, div.appendChild(textLayerDiv); } var textLayer = this.textLayer = - textLayerDiv ? new TextLayerBuilder({ - textLayerDiv: textLayerDiv, - pageIndex: this.id - 1, - lastScrollSource: PDFView - }) : null; + textLayerDiv ? new TextLayerBuilder({ + textLayerDiv: textLayerDiv, + pageIndex: this.id - 1, + lastScrollSource: PDFView, + isViewerInPresentationMode: PDFView.isPresentationMode + }) : null; if (outputScale.scaled) { var cssScale = 'scale(' + (1 / outputScale.sx) + ', ' +