From 02860638b9dba567351a6af16161372910509bbd Mon Sep 17 00:00:00 2001 From: volatile-static Date: Sat, 15 Oct 2022 16:50:48 +0800 Subject: [PATCH 1/2] fix viewer layout Due to the toolbar has a 32px height, the height of `#viewerContainer` must shrink by 32px from inherited `100%`. --- addon/chrome/content/previewPDF.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/chrome/content/previewPDF.html b/addon/chrome/content/previewPDF.html index a5ec848..33a924e 100644 --- a/addon/chrome/content/previewPDF.html +++ b/addon/chrome/content/previewPDF.html @@ -27,7 +27,7 @@ } #viewerContainer { display: block; - height: inherit; + height: calc(100% - 32px); overflow-y: scroll; } .viewerCanvas { From f5d2d4e3d127b03572c7439266019c98b59da88b Mon Sep 17 00:00:00 2001 From: volatile-static <1043064987@qq.com> Date: Sat, 15 Oct 2022 17:16:28 +0800 Subject: [PATCH 2/2] fix update tool bar --- addon/chrome/content/previewPDF.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addon/chrome/content/previewPDF.html b/addon/chrome/content/previewPDF.html index 33a924e..6057770 100644 --- a/addon/chrome/content/previewPDF.html +++ b/addon/chrome/content/previewPDF.html @@ -27,7 +27,7 @@ } #viewerContainer { display: block; - height: calc(100% - 32px); + height: inherit; overflow-y: scroll; } .viewerCanvas { @@ -126,6 +126,7 @@ var zoomTime = 0; function updateToolbar(previewType) { + const viewerContainer = document.getElementById("viewerContainer"); const toolbar = document.querySelector(".toolbar"); const showToolbar = ((previewType === 1 || previewType === 3) && @@ -133,6 +134,7 @@ (previewType === 2 && Zotero.Prefs.get("pdfpreview.showToolInTab")); toolbar.style.visibility = showToolbar ? "visible" : "hidden"; toolbar.style.height = showToolbar ? "32px" : "0"; + viewerContainer.style.height = showToolbar ? "calc(100% - 32px)" : "inherit"; } function getScale() {