From 399b27079c7c09cbee9d7d07bbed865d4ec7bc29 Mon Sep 17 00:00:00 2001 From: James Yu Date: Fri, 4 Oct 2024 18:12:10 +0800 Subject: [PATCH] Offset page origin with viewer offsets --- viewer/components/refresh.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/viewer/components/refresh.ts b/viewer/components/refresh.ts index 0f212ca08..cb0fdb544 100644 --- a/viewer/components/refresh.ts +++ b/viewer/components/refresh.ts @@ -183,15 +183,17 @@ function addMasks() { continue } + const viewerBound = viewerDom.getBoundingClientRect() const pageBound = visiblePage.view.div.getBoundingClientRect() const canvasBound = canvas.getBoundingClientRect() + const div = document.createElement('div') div.className = 'page-loading-mask' masks.push(div) div.style.display = 'none' - div.style.left = pageBound.x + 'px' - div.style.top = pageBound.y + 'px' - div.style.width = Math.min(viewerDom.getBoundingClientRect().width, pageBound.width) + 'px' + div.style.left = pageBound.x - viewerBound.x + 'px' + div.style.top = pageBound.y - viewerBound.y + 'px' + div.style.width = pageBound.width + 'px' div.style.height = pageBound.height + 'px' const img = new Image()