I really like the Raphael Javascript library which is very useful for handling SVG with javascript.
However there is an offset value which is added to the generated svg code that I don't understand. Does anybody know where does it come from and how to avoid it?
Here is my JS code:
var paper = Raphael("canvas", 510, 510);
paper.clear();
paper.rect(0, 0, 500, 500, 10).attr({fill: "#fff", stroke: "black"});
The generated SVG code is
<div id="canvas">
<svg width="510" height="510">
<desc>Created with Raphaël</desc>
<defs/>
<rect x="0.5" y="0.5" width="500" height="500" r="10" rx="10" ry="10" fill="#ffffff" stroke="#000000"/>
</svg>
</div>
Why does the x and y attributes of the rect are 0.5 and not 0?
Update: It seems that the values are rounded with the code below:
var round = function (num) {
return +num + (~~num === num) * .5;
};
Does anybody know the reason?