-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
@remotion/web-renderer: Fix margins being applied twice
#5968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where margins on SVG elements were being applied twice during rendering in the @remotion/web-renderer package. The fix sets margins to '0' before serializing the SVG, since margins are already included in positioning calculations.
Key changes:
- Added margin reset logic in
svgToImageBitmapfunction to prevent double-counting - Added a comprehensive test case with nested transforms and margins to verify the fix
- Updated test viewport height from 720 to 1080 to accommodate the new 1080x1080 test composition
Reviewed Changes
Copilot reviewed 3 out of 6 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/web-renderer/src/compose-svg.ts | Added margin reset (marginLeft, marginRight, marginTop, marginBottom) before SVG serialization to fix double-counting issue |
| packages/web-renderer/src/test/transforms.test.tsx | Added new test case "complicated example" with nested transforms and SVG elements using margins to verify the fix |
| packages/web-renderer/vitest.config.ts | Increased viewport height from 720 to 1080 pixels across all browser configs to support the new test dimensions |
| packages/web-renderer/src/test/screenshots/*.png | Added visual regression test snapshots for the new test across different browsers (chromium, firefox, webkit) |
No description provided.