Merge pull request #3941 from Snuffleupagus/search-from-current-page

Begin searching from current page
This commit is contained in:
Yury Delendik 2013-12-03 08:53:16 -08:00
commit 1d276b0396

View File

@ -203,8 +203,8 @@ var PDFFindController = {
}, },
nextMatch: function() { nextMatch: function() {
var pages = this.pdfPageSource.pages;
var previous = this.state.findPrevious; var previous = this.state.findPrevious;
var currentPageIndex = this.pdfPageSource.page - 1;
var numPages = this.pdfPageSource.pages.length; var numPages = this.pdfPageSource.pages.length;
this.active = true; this.active = true;
@ -213,7 +213,7 @@ var PDFFindController = {
// Need to recalculate the matches, reset everything. // Need to recalculate the matches, reset everything.
this.dirtyMatch = false; this.dirtyMatch = false;
this.selected.pageIdx = this.selected.matchIdx = -1; this.selected.pageIdx = this.selected.matchIdx = -1;
this.offset.pageIdx = previous ? numPages - 1 : 0; this.offset.pageIdx = currentPageIndex;
this.offset.matchIdx = null; this.offset.matchIdx = null;
this.hadMatch = false; this.hadMatch = false;
this.resumeCallback = null; this.resumeCallback = null;