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

feat: rounding width / height #85

Merged
merged 2 commits into from
Mar 16, 2022
Merged

feat: rounding width / height #85

merged 2 commits into from
Mar 16, 2022

Conversation

yisibl
Copy link
Member

@yisibl yisibl commented Mar 15, 2022

Physical pixels cannot be decimal, and when SVG dimensions have decimals in them, the output PNG dimensions are rounded. This should be consistent when getting the PNG size through the width / height API.

This will further improve #61.

@vercel
Copy link

vercel bot commented Mar 15, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/yisibl/resvg-js/DAq1FhRXTvtg2oa1mkjRjhhEEAJv
✅ Preview: https://resvg-js-git-round-svg-size-yisibl.vercel.app

Physical pixels cannot be decimal, and when SVG dimensions have decimals in them, the output PNG dimensions are rounded. This should be consistent when getting the PNG size through the width / height API.
@yisibl yisibl changed the title Round svg size feat: rounding width / height Mar 15, 2022
@yisibl yisibl requested a review from zimond March 15, 2022 11:12
@@ -5,8 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>resvg-js playground</title>
<link rel="preload" as="fetch" type="application/wasm" href="https://unpkg.com/@resvg/resvg-wasm@2.0.0-alpha.3/index_bg.wasm">
<script src="https://unpkg.com/@resvg/resvg-wasm@2.0.0-alpha.3/index.min.js"></script>
<link rel="preload" as="fetch" type="application/wasm" href="https://unpkg.com/@resvg/resvg-wasm@2.0.0-alpha.4/index_bg.wasm" crossorigin>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-domain requires adding crossorigin

@zimond zimond merged commit 761182c into main Mar 16, 2022
@yisibl yisibl deleted the round-svg-size branch March 16, 2022 03:48
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.

2 participants