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:
parent
7aca53b1a4
commit
b14c1fbc28
@ -355,10 +355,10 @@ class PDFFindController {
|
|||||||
this._pdfViewer.currentPageNumber = index + 1;
|
this._pdfViewer.currentPageNumber = index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const page = this._pdfViewer.getPageView(index);
|
this._eventBus.dispatch('updatetextlayermatches', {
|
||||||
if (page.textLayer) {
|
source: this,
|
||||||
page.textLayer.updateMatches();
|
pageIndex: index,
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_nextMatch() {
|
_nextMatch() {
|
||||||
|
@ -358,7 +358,7 @@ class TextLayerBuilder {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
_boundEvents.updateTextLayerMatches = (evt) => {
|
_boundEvents.updateTextLayerMatches = (evt) => {
|
||||||
if (evt.pageIndex !== -1) {
|
if (evt.pageIndex !== this.pageIdx && evt.pageIndex !== -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.updateMatches();
|
this.updateMatches();
|
||||||
|
Loading…
Reference in New Issue
Block a user