【发布时间】:2013-11-14 15:22:06
【问题描述】:
对于我的使用来说,将 SVG symbols 列表以零为中心对我来说会很方便,这使得它们在 use 中的位置更容易。例如,一个简单的圆形符号的中心为零,然后是给定的半径。但是,使用标准剪裁会剪掉 3/4 的圆。这是一个例子:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1" width="400.0" height="400.0" preserveAspectRatio="xMidYMid meet"
viewBox="0.0 0.0 230.0 150.0">
<rect x="0.0" y="0.0" width="230.0" height="150.0" style="stroke:#000000; stroke-width:0.5 ; fill:#B9FFFF;"/>
<symbol id="concentric">
<circle cx="0.0" cy="0.0" r="10.0" style="stroke:#FF0000; stroke-width:0.266; fill:none"/>
<circle cx="0.0" cy="0.0" r="5.0" style="stroke:#00FF00; stroke-width:0.266; fill:none"/>
</symbol>
<use xlink:href="#concentric" x="20" y="20" />
<use xlink:href="#concentric" x="40" y="20" />
<use xlink:href="#concentric" x="60" y="20" />
</svg>
这将导致符号“同心”的三种用途,但由于原始符号在 0,0 处有两个圆,因此四分之三的符号被剪裁。
不将符号剪裁在 0 0 处的最简单方法是什么?
【问题讨论】: