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)