fix(export): convert PPTX shadow offset from px to pt (#679)

getShadowOption converted the shadow blur from px to pt but left the offset
in px. pptxgenjs expects both in points (ratioPx2Pt = 96/72 × viewportSize/960),
so shadows exported ~33% too far from their element at the default viewport
while the blur radius was correct. Divide the offset by ratioPx2Pt like blur.

Closes #678

Co-authored-by: ly-wang19 <ly-wang19@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: wyuc <wang-yc24@mails.tsinghua.edu.cn>
This commit is contained in:
ly-wang19 2026-06-30 16:59:00 +08:00 committed by GitHub
parent a3f88d53e5
commit 19ff0cef42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -290,8 +290,11 @@ function getShadowOption(shadow: PPTElementShadow, ratioPx2Pt: number): pptxgen.
type: 'outer',
color: c.color.replace('#', ''),
opacity: c.alpha,
// pptxgenjs shadow blur AND offset are in points; the source model is in
// pixels. blur was converted but offset was not, so shadows exported ~33%
// too far at the default viewport (ratioPx2Pt = 96/72 × viewportSize/960).
blur: shadow.blur / ratioPx2Pt,
offset,
offset: offset / ratioPx2Pt,
angle,
};
}