RED-6917: Fix page navigation while search is active

This commit is contained in:
Dan Percic 2023-06-20 18:37:47 +03:00
parent 40c5a9cd22
commit 7bc282913b
3 changed files with 8 additions and 7 deletions

View File

@ -177,6 +177,8 @@ export class FilePreviewScreenComponent
effect(() => {
if (this._viewModeService.viewMode()) {
this.updateViewMode().then();
this._logger.info('[PDF] Stamp pdf');
this._stampService.stampPDF().then();
}
});
}
@ -274,8 +276,6 @@ export class FilePreviewScreenComponent
}
}
this._logger.info('[PDF] Stamp pdf');
await this._stampService.stampPDF();
this._logger.info('[PDF] Rebuild filters');
this.#rebuildFilters();
this._logger.info('[PDF] Update done');

View File

@ -32,6 +32,7 @@ export class StampService {
const file = this._state.file();
const allPages = [...Array(file.numberOfPages).keys()].map(page => page + 1);
await pdfDoc.lock();
try {
await clearStamps(pdfDoc, this._pdf.PDFNet, allPages, this._licenseService.activeLicenseKey);
} catch (e) {
@ -48,7 +49,8 @@ export class StampService {
await this._stampExcludedPages(pdfDoc, file.excludedPages);
}
this._documentViewer.refreshAndUpdateView();
this._documentViewer.refreshAndUpdateView(Array.from({ length: await pdfDoc.getPageCount() }, (_x, i) => i + 1));
await pdfDoc.unlock();
}
private async _stampExcludedPages(document: PDFNet.PDFDoc, excludedPages: number[]): Promise<void> {

View File

@ -120,11 +120,10 @@ export class REDDocumentViewer {
}
}
refreshAndUpdateView() {
this.#document.refreshAll();
// do not adjust this page if is compare mode
refreshAndUpdateView(visiblePages: number[]) {
const currentPage = this.#document.getCurrentPage();
this.#document.updateView([currentPage], currentPage);
this.#document.refreshAll();
this.#document.updateView(visiblePages, currentPage);
}
resetRotation(pages: number | number[] | string | string[]) {