From 19ff0cef42a42b112256ba767d4669578e98bc3c Mon Sep 17 00:00:00 2001 From: ly-wang19 <94427531+ly-wang19@users.noreply.github.com> Date: Tue, 30 Jun 2026 16:59:00 +0800 Subject: [PATCH] fix(export): convert PPTX shadow offset from px to pt (#679) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Claude Opus 4.8 (1M context) Co-authored-by: wyuc --- lib/export/use-export-pptx.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/export/use-export-pptx.ts b/lib/export/use-export-pptx.ts index 4b71b27..86b6391 100644 --- a/lib/export/use-export-pptx.ts +++ b/lib/export/use-export-pptx.ts @@ -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, }; }