我在HTML中有SVG行,并且想要更改结束坐标。
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" >
<line id="myline" x1="0" y1="0" x2="200" y2="200"
style="stroke:rgb(255,0,0);stroke-width:2"/>
</svg>
在Dart代码中,我具有以下内容:
LineElement line = query("#myline");
我需要将x2从200更改为220,但我看不到行的x2属性。
有可能这样做吗?
最佳答案
正如您在http://api.dartlang.org/docs/releases/latest/dart_svg/LineElement.html#x2文档中所见,LineElement确实具有x2属性。
您可以通过以下两种方法之一设置x2:
line.attributes["x2"] = "220";
line.$dom_setAttribute("x2", "220");
关于dart - 更改DART中svg行的长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16679388/