Skip to content

Update index.ts #653

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

Merged
merged 2 commits into from
Apr 23, 2025
Merged

Update index.ts #653

merged 2 commits into from
Apr 23, 2025

Conversation

chinenkai
Copy link
Contributor

导出的PNG图片改为2倍大小,避免在手机上查看导出图片显得模糊。

导出的PNG图片改为2倍大小,避免在手机上查看导出图片显得模糊。
Copy link

github-actions bot commented Apr 22, 2025

🎊 PR Preview has been successfully built and deployed to https://doocs-md-preview-pr-653.surge.sh

@yanglbme
Copy link
Member

@chinenkai

默认是 window.devicePixelRatio,我设备上的浏览器 console 打印是 3。固定写 2,可能反而会变模糊?

你的设备是什么值?

@chinenkai
Copy link
Contributor Author

@chinenkai

默认是 window.devicePixelRatio,我设备上的浏览器 console 打印是 3。固定写 2,可能反而会变模糊?

你的设备是什么值?

@yanglbme 我的设备是1。

也就是说,部分非高清屏幕的电脑,正常导出png的话,导出得到的图片宽度大概460px左右,这个尺寸的图片在手机端查看比较模糊。
所以这里,建议是改成 window.devicePixelRatio 和 2 取大的那个值。

从window.devicePixelRatio和2中,取较大的值,避免非高清屏设备,导出的PNG图片尺寸太小,分享到移动端显得模糊。
@yanglbme
Copy link
Member

可以,我的想法也是取 max

@yanglbme yanglbme merged commit da8cf0d into doocs:main Apr 23, 2025
2 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.

2 participants