Skip to content

Commit

Permalink
Still highlight annotation position if annotation no longer exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Nov 15, 2023
1 parent 2241cf5 commit f3a4010
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/pdf/pdf-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,24 +670,26 @@ class PDFView {
this._history.save({ dest: [pageIndex, { name: 'XYZ' }, left, top, null] });
}

_highlightPosition(position) {
this._highlightedPosition = position;
this._render();
setTimeout(() => {
this._highlightedPosition = null;
this._render();
}, 2000);
}

navigate(location, skipHistory) {
if (location.annotationID) {
if (location.annotationID && this._annotations.find(x => x.id === location.annotationID)) {
let annotation = this._annotations.find(x => x.id === location.annotationID);
if (annotation) {
this.navigateToPosition(annotation.position);
}
this.navigateToPosition(annotation.position);
}
else if (location.dest) {
this._iframeWindow.PDFViewerApplication.pdfLinkService.goToDestination(location.dest);
}
else if (location.position) {
this.navigateToPosition(location.position);
this._highlightedPosition = location.position;
this._render();
setTimeout(() => {
this._highlightedPosition = null;
this._render();
}, 2000);
this._highlightPosition(location.position);
}
else if (Number.isInteger(location.pageIndex)) {
this._iframeWindow.PDFViewerApplication.pdfViewer.scrollPageIntoView({
Expand Down

0 comments on commit f3a4010

Please sign in to comment.