[ACA-3853] fix use of more recent pdf viewer versions (#6007)

* fix use of more recent pdf viewer versions

* fix unit test with thte new promise
This commit is contained in:
Eugenio Romano
2020-08-15 19:05:38 +01:00
committed by GitHub
parent d5d9e70e60
commit bf72fd6c9e
6 changed files with 38 additions and 49 deletions

View File

@@ -103,8 +103,12 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
getPages() {
return this.pdfViewer._pages.map((page) => ({
id: page.id,
getWidth: () => { return this.width; },
getHeight: () => { return this.currentHeight; },
getWidth: () => {
return this.width;
},
getHeight: () => {
return this.currentHeight;
},
getPage: () => this.pdfViewer.pdfDocument.getPage(page.id)
}));
}
@@ -115,7 +119,7 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
}
private calculateHeight(page) {
const viewport = page.getViewport(1);
const viewport = page.getViewport({ scale: 1 });
const pageRatio = viewport.width / viewport.height;
const height = Math.floor(this.width / pageRatio);
@@ -133,7 +137,7 @@ export class PdfThumbListComponent implements OnInit, AfterViewInit, OnDestroy {
const end = Math.ceil(indexByScrollTop) + (itemsInView);
this.translateY = this.itemHeight * Math.ceil(start);
this.virtualHeight = this.itemHeight * this.items.length - this.translateY;
this.virtualHeight = this.itemHeight * this.items.length - this.translateY;
this.renderItems = this.items.slice(start, end);
}