Repository navigation
fix: avoid mutating shared shadow options during serialization - #1538
Open
vhinayindia wants to merge 1 commit into
Open
vhinayindia wants to merge 1 commit into
vhinayindia wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Fix shared shadow options being converted repeatedly during slide XML generation. Four shapes sharing one shadow currently emit blurRad values of 76200, 967740000, 12290298000000, and 156086784600000000. This change emits 76200 for each and keeps subsequent writes stable.
Change Description
Copy shadow options locally in the image and shape XML paths before converting to OOXML units. Preserve explicit zero blur, offset, angle, and opacity rather than replacing them with defaults. Only src/gen-xml.ts is changed; no generated bundles or dependencies are submitted.
Change Type
Related Issue
Fixes #1527.
Motivation and Context
Reusing a shadow style across shapes or images, or writing the same presentation twice, should not multiply already-converted values. The existing mutation corrupts shadow XML and changes the options object supplied by the caller.
Checklist before requesting a review
Validation
Reproduced the issue on upstream 3c9ec1b before changing the source. After the change, npm run build, npx eslint src/gen-xml.ts, npx tsc --noEmit, and git diff --check passed. A separate local regression harness checks shared shapes, shared images, mixed shape/image use, repeated writes, unchanged caller options, exact blur/dist/dir/alpha values, and explicit zero values.
Validation inspects XML extracted from generated PPTX archives. PowerPoint/LibreOffice visual rendering and browser Run All Demos have not been performed.
Sample Code
Run from the repository after npm run build: