,我试图加载这个svg(已分组):
<?xml version="1.0" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g id="DEFAULT" display="visible">
<path d="M291.94 240.98L292.64 240.79M292.64 240.79L293.16 240.27M293.16 240.27L293.35 239.57"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M293.35 208.24L293.16 207.54M293.16 207.54L292.64 207.02M292.64 207.02L291.94 206.84"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M293.35 208.24L293.35 239.57"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M231.12 223.91L231.12 223.91"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M231.12 223.91L231.12 239.57"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M231.12 223.91L231.12 208.24"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M232.52 206.84L231.82 207.02M231.82 207.02L231.31 207.54M231.31 207.54L231.12 208.24"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M231.12 239.57L231.31 240.27M231.31 240.27L231.82 240.79M231.82 240.79L232.52 240.98"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M232.52 206.84L291.94 206.84"
fill="none" stroke="black" stroke-width="0.5"/>
<path d="M232.52 240.98L291.94 240.98"
fill="none" stroke="black" stroke-width="0.5"/>
</g>
</svg>
结果是:
正如你所看到的,我有一个奇怪的选定区域...我如何修复svg以便在选择对象上获得正确的控制区域?
提前致谢
答案 0 :(得分:0)
您需要将这些属性添加到SVG中,以便它只是在当前坐标处查看SVG的一部分。
<svg ... viewBox="231.12 206.84 62.23 34.14">
(我&#34;作弊&#34;通过在Illustrator中打开SVG来获取这些值,将画板更改为仅扩展到路径的边缘,然后再次保存文件以查看它将给出的viewBox值我(虽然当然如果你能够了解&#34; d&#34;属性是如何工作的,我仍然无法完全做到:),你可能只是通过一些算法得到它们。 )