DNS
unread,Aug 10, 2009, 11:35:27 PM8/10/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Raphaël
I'm new to Raphael, and am really liking this library. One thing I
haven't been able to figure out, though, which seems like it should be
simple, is how to draw a 1-pixel-wide line, or give a rect a 1-pixel
stroke. For example:
canvas.rect(20, 20, 60, 60).attr({stroke: "#000"});
The on-screen width of the border around the rect is 2 pixels. If I
draw a filled rect on top, with no stroke, it reduces the outline to 1
pixel, implying that 'stroke' draws one pixel inside the rect, and one
outside:
canvas.rect(20, 20, 60, 60).attr({fill: "#fff", 'stroke-width': 0});
If I then draw a line on top, the difference in widths is obvious:
canvas.path({stroke: "#000", 'stroke-width': 1.0}, "M30,30 L70,30");
I tried reducing the stroke-width below 1.0, but that only makes the
line lighter:
canvas.path({stroke: "#000", 'stroke-width': 0.5}, "M30,40 L70,40");
What's the correct way to get a 1px rather than 2px line or stroke?
I'm using FF3.5, if that matters. Thanks!