diff --git a/web/pdf_find_controller.js b/web/pdf_find_controller.js index 71457d9df..8a8bc89a9 100644 --- a/web/pdf_find_controller.js +++ b/web/pdf_find_controller.js @@ -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() { diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js index 281f22a88..1e7431b2e 100644 --- a/web/text_layer_builder.js +++ b/web/text_layer_builder.js @@ -358,7 +358,7 @@ class TextLayerBuilder { } }; _boundEvents.updateTextLayerMatches = (evt) => { - if (evt.pageIndex !== -1) { + if (evt.pageIndex !== this.pageIdx && evt.pageIndex !== -1) { return; } this.updateMatches();