From 04e5cd70711463a8ed18cf3e796d920b0b341371 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Fri, 11 Sep 2026 01:13:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=89=8D=E7=AB=AF=E7=95=8C=E9=9D=A2):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=BB=9A=E5=8A=A8=E6=9D=A1=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E9=85=8D=E8=89=B2=E6=9B=B4=E8=BD=BB=E7=9B=88=E5=8D=8F?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/webui/ofdgo.css | 7 +++++++ assets/webui/ofdgo.js | 1 + ofdgo_renderer_image.go | 10 ++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/webui/ofdgo.css b/assets/webui/ofdgo.css index 35e5cdf..689933a 100644 --- a/assets/webui/ofdgo.css +++ b/assets/webui/ofdgo.css @@ -285,6 +285,13 @@ body[data-hide-meta] .meta-panel { display: none; } +.page-list-panel, +.viewer-panel, +.meta-panel { + scrollbar-width: thin; + scrollbar-color: var(--line-strong) transparent; +} + .page-list-panel, .meta-panel { min-height: 0; diff --git a/assets/webui/ofdgo.js b/assets/webui/ofdgo.js index b17c3bf..b50c336 100644 --- a/assets/webui/ofdgo.js +++ b/assets/webui/ofdgo.js @@ -2517,6 +2517,7 @@ function scrollbarWidth() { probe.style.width = "100px"; probe.style.height = "100px"; probe.style.overflow = "scroll"; + probe.style.scrollbarWidth = getComputedStyle(el.viewerPanel).scrollbarWidth; probe.style.left = "-9999px"; document.body.append(probe); const width = probe.offsetWidth - probe.clientWidth; diff --git a/ofdgo_renderer_image.go b/ofdgo_renderer_image.go index e0f6ad6..a09fb2f 100644 --- a/ofdgo_renderer_image.go +++ b/ofdgo_renderer_image.go @@ -310,13 +310,15 @@ func imageWithTransparentEdge(img image.Image) (image.Image, int) { src, ok := source.(*image.NRGBA) if ok { srcBounds := src.Bounds() + hasZero = src.Pix[3] == 0 + hasVisible = !hasZero + scan: for y := srcBounds.Min.Y; y < srcBounds.Max.Y; y++ { offset := src.PixOffset(srcBounds.Min.X, y) + 3 for x := 0; x < w; x++ { - if src.Pix[offset] == 0 { - hasZero = true - } else { - hasVisible = true + if (src.Pix[offset] == 0) != hasZero { + hasZero, hasVisible = true, true + break scan } offset += 4 }