【发布时间】:2020-03-26 05:33:42
【问题描述】:
在这个jsFiddle 中,我有两个 SVG 矩形。第一个在 SVG 标签内,第二个用 Raphael JS 渲染。两个矩形都应该与双边框相同,但它们不是。在 Raphael JS 中使用 node.setAttribute 应该设置低级 SVG 属性,所以这应该可以工作。这里缺少什么?
<svg height="100" width="100">
<rect class="rect2" height="50" width="50" x='25' y='25' />
</svg>
<div id="the_canvas"></div>
.rect2 {
fill: none;
outline: 2px double black;
outline-offset: 0;
}
var w = 100, h = 100;
var paper = Raphael("the_canvas", w, h);
var rect = paper.rect(25,25,50,50);
rect.node.setAttribute('fill', 'none');
rect.node.setAttribute('outline','2px double black');
rect.node.setAttribute('outline-offset', 0);
【问题讨论】:
标签: javascript svg raphael