Skip to content

Commit

Permalink
Merge pull request #146 from ewchow/master
Browse files Browse the repository at this point in the history
updated PDFPageView.update calls to supply an object instead of positional args
  • Loading branch information
arkokoley authored Mar 28, 2023
2 parents 725ad9b + 4097961 commit 87eca72
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/Pdfvuer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@
},
rotate: function (newRotate) {
if (this.pdfViewer) {
this.pdfViewer.update(this.scale, newRotate);
this.pdfViewer.update({
scale: this.scale,
rotation: newRotate,
});
this.pdfViewer.draw();
}
},
Expand Down Expand Up @@ -197,15 +200,21 @@
},
methods: {
calculateScale: function (width = -1, height = -1) {
this.pdfViewer.update(1, this.rotate); // Reset scaling to 1 so that "this.pdfViewer.viewport.width" gives proper width;
this.pdfViewer.update({
scale: 1,
rotation: this.rotate,
}); // Reset scaling to 1 so that "this.pdfViewer.viewport.width" gives proper width;
if (width === -1 && height === -1) {
width = this.$refs.container.offsetWidth;
}
return width / this.pdfViewer.viewport.width;
},
calculateScaleHeight: function () {
this.pdfViewer.update(1, this.rotate); // Reset scaling to 1 so that "this.pdfViewer.viewport.width" gives proper width;
this.pdfViewer.update({
scale: 1,
rotation: this.rotate,
}); // Reset scaling to 1 so that "this.pdfViewer.viewport.width" gives proper width;
var height = this.$refs.container.offsetHeight;
var parentel = this.$refs.container.parentElement.parentElement;
return parentel.offsetHeight / height;
Expand All @@ -220,7 +229,10 @@
newScale = this.calculateScaleHeight();
this.$emit("update:scale", newScale);
}
this.pdfViewer.update(newScale, this.rotate);
this.pdfViewer.update({
scale: newScale,
rotation: this.rotate,
});
// The SimpleLinkService from the DefaultAnnotationLayerFactory doesn't do anything with links so override with our LinkService after it is created
if(this.annotation) {
this.pdfViewer.annotationLayer = this.pdfViewer.annotationLayerFactory.createAnnotationLayerBuilder(this.pdfViewer.div, this.pdfViewer.pdfPage);
Expand Down

0 comments on commit 87eca72

Please sign in to comment.