我有一个简单的SVG树,我想RECT2的x属性是对Rect1的宽度依赖(引用)的属性:SVG:使元素的属性依赖另一种元素
<rect id="rect1" style="fill:black" x="35" y="0" width="30" height="40" />
<rect id="rect2" style="fill:black" x="**rect1.width**" y="40" width="26" height="10" />
是类似于SVG中的可能,我在yahoogle或SVG参考中找不到它。
另一种方法是变量
**var widthOfRect1 = 30**
<rect id="rect1" style="fill:black" x="35" y="0" width="widthOfRect1" height="40" />
<rect id="rect2" style="fill:black" x="widthOfRect1" y="40" width="26" height="10" />
有没有办法做到这一点?我知道你可以传入参数,但那不是我正在寻找的。
想法?
你可能想要检查是否https://github.com/indus/VLEX做你想要的。 – 2014-05-02 09:09:25