fix(pdf): widen the halo glow so main-view selections read from across the page
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
add408eee4
commit
4f8ea9e691
1 file changed
+30
-14
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user