From 4f8ea9e691efb68b52732f295ed8e55a88c159f4 Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Wed, 20 May 2026 05:21:43 +0200 Subject: [PATCH] fix(pdf): widen the halo glow so main-view selections read from across the page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single 6px Gaussian blur was being attenuated to near-invisible by the SVG → canvas → PNG → pdf-lib pipeline (each stage loses some alpha). The halo is now built from two stacked passes: - a wide pass (stdDeviation=18) merged three times for the outer glow, - a tighter pass (stdDeviation=8) merged twice to keep the selection anchored to the original point instead of dissolving into a fog. Result: zone highlights stay obvious at print scale and from a couple of feet away. Detail-view rendering is unchanged. Co-Authored-By: Claude --- src/pdf/render/observationPage.ts | 44 +++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/pdf/render/observationPage.ts b/src/pdf/render/observationPage.ts index a6caf17b..934e1297 100644 --- a/src/pdf/render/observationPage.ts +++ b/src/pdf/render/observationPage.ts @@ -82,22 +82,38 @@ function ensureHaloFilter(root: SVGSVGElement): void { filter.setAttribute('height', '300%') filter.setAttribute('filterUnits', 'userSpaceOnUse') - const blur = doc.createElementNS(SVG_NS, 'feGaussianBlur') - blur.setAttribute('in', 'SourceGraphic') - blur.setAttribute('stdDeviation', '6') - blur.setAttribute('result', 'halo') - filter.appendChild(blur) + // Two-stage blur: a wide outer halo for "spotted from across the + // room" visibility, plus a tighter inner halo that keeps the + // selection anchored to the original point so it doesn't dissolve. + const wide = doc.createElementNS(SVG_NS, 'feGaussianBlur') + wide.setAttribute('in', 'SourceGraphic') + wide.setAttribute('stdDeviation', '18') + wide.setAttribute('result', 'haloWide') + filter.appendChild(wide) + + const tight = doc.createElementNS(SVG_NS, 'feGaussianBlur') + tight.setAttribute('in', 'SourceGraphic') + tight.setAttribute('stdDeviation', '8') + tight.setAttribute('result', 'haloTight') + filter.appendChild(tight) const merge = doc.createElementNS(SVG_NS, 'feMerge') - const m1 = doc.createElementNS(SVG_NS, 'feMergeNode') - m1.setAttribute('in', 'halo') - const m2 = doc.createElementNS(SVG_NS, 'feMergeNode') - m2.setAttribute('in', 'halo') - const m3 = doc.createElementNS(SVG_NS, 'feMergeNode') - m3.setAttribute('in', 'SourceGraphic') - merge.appendChild(m1) - merge.appendChild(m2) - merge.appendChild(m3) + // Stack the wide halo three times so its contribution survives the + // canvg → PNG → pdf-lib pipeline (each pass attenuates alpha) and + // still reads as a strong glow at print scale. + for (let i = 0; i < 3; i += 1) { + const n = doc.createElementNS(SVG_NS, 'feMergeNode') + n.setAttribute('in', 'haloWide') + merge.appendChild(n) + } + for (let i = 0; i < 2; i += 1) { + const n = doc.createElementNS(SVG_NS, 'feMergeNode') + n.setAttribute('in', 'haloTight') + merge.appendChild(n) + } + const source = doc.createElementNS(SVG_NS, 'feMergeNode') + source.setAttribute('in', 'SourceGraphic') + merge.appendChild(source) filter.appendChild(merge) defs.appendChild(filter)