diff --git a/src/display/canvas.js b/src/display/canvas.js index ef789af81..5b98d9581 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -2726,8 +2726,9 @@ class CanvasGraphics { canvasHeight ); const { canvas, context } = this.annotationCanvas; - canvas.style.width = `calc(${width}px * var(--viewport-scale-factor))`; - canvas.style.height = `calc(${height}px * var(--viewport-scale-factor))`; + const viewportScaleFactorStr = `var(--zoom-factor) * ${PixelsPerInch.PDF_TO_CSS_UNITS}`; + canvas.style.width = `calc(${width}px * ${viewportScaleFactorStr})`; + canvas.style.height = `calc(${height}px * ${viewportScaleFactorStr})`; this.annotationCanvasMap.set(id, canvas); this.annotationCanvas.savedCtx = this.ctx; this.ctx = context; diff --git a/web/base_viewer.js b/web/base_viewer.js index 3ba5d3a9d..3a47df701 100644 --- a/web/base_viewer.js +++ b/web/base_viewer.js @@ -1012,10 +1012,6 @@ class BaseViewer { } this._doc.style.setProperty("--zoom-factor", newScale); - this._doc.style.setProperty( - "--viewport-scale-factor", - newScale * PixelsPerInch.PDF_TO_CSS_UNITS - ); const updateArgs = { scale: newScale }; for (const pageView of this._pages) { diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index 65085c0a7..e769077f5 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -329,16 +329,14 @@ class PDFPageView { } const totalRotation = (this.rotation + this.pdfPageRotate) % 360; - const viewportScale = this.scale * PixelsPerInch.PDF_TO_CSS_UNITS; this.viewport = this.viewport.clone({ - scale: viewportScale, + scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS, rotation: totalRotation, }); if (this._isStandalone) { const { style } = document.documentElement; style.setProperty("--zoom-factor", this.scale); - style.setProperty("--viewport-scale-factor", viewportScale); } if (this.svg) { diff --git a/web/pdf_viewer.css b/web/pdf_viewer.css index 01c9cfa2d..154e2004f 100644 --- a/web/pdf_viewer.css +++ b/web/pdf_viewer.css @@ -22,7 +22,6 @@ --page-border: 9px solid transparent; --spreadHorizontalWrapped-margin-LR: -3.5px; --zoom-factor: 1; - --viewport-scale-factor: 1; } @media screen and (forced-colors: active) {