From c0148fc483f08f78c93c5c0b2eea233d22980f31 Mon Sep 17 00:00:00 2001 From: octocorvus Date: Thu, 3 Aug 2023 07:58:34 +0000 Subject: [PATCH] viewer: replace window with globalThis --- viewer/js/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/viewer/js/index.js b/viewer/js/index.js index b64f02d..eb5ad1a 100644 --- a/viewer/js/index.js +++ b/viewer/js/index.js @@ -144,7 +144,7 @@ function renderPage(pageNumber, zoom, prerender, prerenderTrigger=0) { } const newCanvas = document.createElement("canvas"); - const ratio = window.devicePixelRatio; + const ratio = globalThis.devicePixelRatio; newCanvas.height = viewport.height * ratio; newCanvas.width = viewport.width * ratio; newCanvas.style.height = viewport.height + "px"; @@ -240,7 +240,7 @@ globalThis.onRenderPage = function (zoom) { }; globalThis.isTextSelected = function () { - return window.getSelection().toString() !== ""; + return globalThis.getSelection().toString() !== ""; }; globalThis.toggleTextLayerVisibility = function () { @@ -281,6 +281,6 @@ globalThis.loadDocument = function () { }); }; -window.onresize = () => { +globalThis.onresize = () => { setLayerTransform(canvas.clientWidth, canvas.clientHeight, textLayerDiv); };