From 846620438417c395f14f3cb60a02806c1b3bebc8 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 31 Aug 2021 17:24:21 +0200 Subject: [PATCH] [GENERIC viewer] Add fallback logic for the old `PDFPageView.update` method signature This is done separately from the previous commit, to make it easier to revert these changes in the future. --- web/pdf_page_view.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index ac1dab94e..1ffb2dbe9 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -298,6 +298,23 @@ class PDFPageView { } update({ scale = 0, rotation = null, optionalContentConfigPromise = null }) { + if ( + typeof PDFJSDev !== "undefined" && + PDFJSDev.test("GENERIC") && + typeof arguments[0] !== "object" + ) { + console.error( + "PDFPageView.update called with separate parameters, please use an object instead." + ); + + this.update({ + scale: arguments[0], + rotation: arguments[1], + optionalContentConfigPromise: arguments[2], + }); + return; + } + this.scale = scale || this.scale; if (typeof rotation === "number") { this.rotation = rotation; // The rotation may be zero.