Removes lastScrollSource and isViewerInPresentationMode from TextLayerBuilderOptions

This commit is contained in:
Yury Delendik 2014-12-17 14:12:51 -06:00
parent b930228788
commit 2ac7ac4678
5 changed files with 67 additions and 48 deletions

View file

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, FirefoxCom, Promise */
/* globals PDFJS, FirefoxCom, Promise, scrollIntoView */
'use strict';
@ -24,6 +24,9 @@ var FindStates = {
FIND_PENDING: 3
};
var FIND_SCROLL_OFFSET_TOP = -50;
var FIND_SCROLL_OFFSET_LEFT = -400;
/**
* Provides "search" or "find" functionality for the PDF.
* This object actually performs the search for a given string.
@ -308,6 +311,26 @@ var PDFFindController = (function PDFFindControllerClosure() {
}
},
/**
* The method is called back from the text layer when match presentation
* is updated.
* @param {number} pageIndex - page index.
* @param {number} index - match index.
* @param {Array} elements - text layer div elements array.
* @param {number} beginIdx - start index of the div array for the match.
* @param {number} endIdx - end index of the div array for the match.
*/
updateMatchPosition: function PDFFindController_updateMatchPosition(
pageIndex, index, elements, beginIdx, endIdx) {
if (this.selected.matchIdx === index &&
this.selected.pageIdx === pageIndex) {
scrollIntoView(elements[beginIdx], {
top: FIND_SCROLL_OFFSET_TOP,
left: FIND_SCROLL_OFFSET_LEFT
});
}
},
nextPageMatch: function PDFFindController_nextPageMatch() {
if (this.resumePageIdx !== null) {
console.error('There can only be one pending page.');