Use the updatetextlayermatches event for highlighting matches on a page

This makes use of the event bus instead of requiring the PDF viewer
instance to get the page view for a page and calling `updateMatches` on
it.
This commit is contained in:
Tim van der Meij 2018-09-21 16:53:52 +02:00
parent 7aca53b1a4
commit b14c1fbc28
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
2 changed files with 5 additions and 5 deletions

View File

@ -355,10 +355,10 @@ class PDFFindController {
this._pdfViewer.currentPageNumber = index + 1;
}
const page = this._pdfViewer.getPageView(index);
if (page.textLayer) {
page.textLayer.updateMatches();
}
this._eventBus.dispatch('updatetextlayermatches', {
source: this,
pageIndex: index,
});
}
_nextMatch() {

View File

@ -358,7 +358,7 @@ class TextLayerBuilder {
}
};
_boundEvents.updateTextLayerMatches = (evt) => {
if (evt.pageIndex !== -1) {
if (evt.pageIndex !== this.pageIdx && evt.pageIndex !== -1) {
return;
}
this.updateMatches();