In plain svg
, the <line>
tag seems to do that just fine, e.g.
<g>
<line class="link" x1="180" y1="280" x2="560" y2="280"></line>
</g>
<g>
<circle class="node" cx="180" cy="280" id="n1" r="18"></circle>
<circle class="node" cx="560" cy="280" id="n2" r="18"></circle>
</g>
Here, the line
element draws a line connecting the two defined nodes.
In RaphaelJS 2
, is there a method for doing this? It seems like the most likely one is path
, but when I try:
var paper = Raphael(document.getElementById("raphael-test"), 600, 600);
var c1 = paper.circle(180, 280, 18);
var c2 = paper.circle(560, 280, 18);
var edge = paper.path("M180,280L560,280");
the line extends into both circles, reaching the center of the circle. Visually I would like the line to just touch the line of circle. Of course, I can just work out the geometry and subtract the radius of the circle for each end given the pair coordinates. But I wonder if some method is already available from RaphaelJS 2
, as this seems to be a very common functionality.