Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

基于 bounding box 设置 SVG 宽高 #5

Closed
yisibl opened this issue May 13, 2021 · 2 comments
Closed

基于 bounding box 设置 SVG 宽高 #5

yisibl opened this issue May 13, 2021 · 2 comments

Comments

@yisibl
Copy link
Collaborator

yisibl commented May 13, 2021

当前生成的 PNG 效果如下图:

image

期望其最终效果是宽度填满,高度等比缩放。也就是说拿到蓝色框的宽高,再根据指定的宽度等比缩放。
image

示例地址:https://www.iconfont.cn/illustrations/detail?spm=a313x.7781069.1998910419.d9df05512&cid=31456
SVG: https://iconfont.alicdn.com/s/e3430542-d8ce-4a0b-aa2b-91c08ec81b9e_origin.svg

@zimond zimond closed this as completed Jul 30, 2021
@yisibl
Copy link
Collaborator Author

yisibl commented Aug 25, 2021

<svg version="1.0"
	xmlns="http://www.w3.org/2000/svg"
	xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 279.22 309.2120">
	<rect width="100%" height="100%" fill="lightblue"/>
	<ellipse cx="139.61" cy="152.36533333333333333333333333" rx="150.16200000000000000000000000" ry="147.88400000000000000000000000" stroke="black" fill="transparent" opacity="0.9" stroke-width="8.962666666666666666666666667" />
	<circle cx="139.61" cy="138.92133333333333333333333333" r="138.92133333333333333333333333" fill="pink" />	
</svg>

这个 SVG inner box 计算有点问题,左右被裁剪了
image

2021-09-09 更新:
该项目不再考虑超出 viewBox 区域的 SVG,关闭这个 issue。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants