Skip to content
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

Fix image size for svg #1186

Merged
merged 1 commit into from
Dec 31, 2024
Merged

Fix image size for svg #1186

merged 1 commit into from
Dec 31, 2024

Conversation

nighca
Copy link
Collaborator

@nighca nighca commented Dec 30, 2024

Updated behavior: Use the viewBox size for SVG images in Builder to ensure consistency with SPX.

Previous behavior: We retrieved the size of the <img> element containing SVG to determine the image size. While it was rendered within a 300x150 box by default, resulting in dimensions like 300x150, 140x150, 300x100, etc.

Why is the rendered SVG sometimes very small?

In some user-agents, when they fail to calculate a size for the element they fall back to a default size for replaced elements of 300px width × 150px height. That size is from deep within a dark corner of the CSS 2.1 spec, so I guess that’s somewhat reasonable. Mostly it seems to happen when the viewBox attribute values are set in pixels instead of unitless.

Related:

Copy link

qiniu-prow bot commented Dec 30, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@nighca nighca marked this pull request as ready for review December 30, 2024 02:16
@qiniu-ci
Copy link

This PR has been deployed to the preview environment. You can explore it using the preview URL.

Warning

Please note that deployments in the preview environment are temporary and will be automatically cleaned up after a certain period. Make sure to explore it before it is removed. For any questions, contact the Go+ Builder team.

@nighca nighca merged commit d0f9047 into goplus:dev Dec 31, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants