From 8ea83f7030cc0e17aed8ea51b339a5a64a701544 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 8 Apr 2021 12:21:52 +0200 Subject: [PATCH] Convert some properties, on `PDFThumbnailView`-instances, to local variables These properties are always updated/used together, and there's no other methods which depend on just one of them, hence they're changed into local variables instead. Looking through the history of this code, it seems they were converted *from* local variables and to properties all the way back in PR 2914; however as far as I can tell from that diff it doesn't seem to have been necessary even back then!? --- web/pdf_thumbnail_view.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/web/pdf_thumbnail_view.js b/web/pdf_thumbnail_view.js index ac8899089..cbb919fc3 100644 --- a/web/pdf_thumbnail_view.js +++ b/web/pdf_thumbnail_view.js @@ -122,13 +122,13 @@ class PDFThumbnailView { }; this.disableCanvasToImageConversion = disableCanvasToImageConversion; - this.pageWidth = this.viewport.width; - this.pageHeight = this.viewport.height; - this.pageRatio = this.pageWidth / this.pageHeight; + const pageWidth = this.viewport.width, + pageHeight = this.viewport.height, + pageRatio = pageWidth / pageHeight; this.canvasWidth = THUMBNAIL_WIDTH; - this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0; - this.scale = this.canvasWidth / this.pageWidth; + this.canvasHeight = (this.canvasWidth / pageRatio) | 0; + this.scale = this.canvasWidth / pageWidth; this.l10n = l10n; @@ -172,12 +172,12 @@ class PDFThumbnailView { this.cancelRendering(); this.renderingState = RenderingStates.INITIAL; - this.pageWidth = this.viewport.width; - this.pageHeight = this.viewport.height; - this.pageRatio = this.pageWidth / this.pageHeight; + const pageWidth = this.viewport.width, + pageHeight = this.viewport.height, + pageRatio = pageWidth / pageHeight; - this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0; - this.scale = this.canvasWidth / this.pageWidth; + this.canvasHeight = (this.canvasWidth / pageRatio) | 0; + this.scale = this.canvasWidth / pageWidth; this.div.removeAttribute("data-loaded"); const ring = this.ring;