javascript - Raphael Rectangle Border - Stack Overflow

When I draw a simple rectangle using the following code the bottom and right edge borders are thicker t

When I draw a simple rectangle using the following code the bottom and right edge borders are thicker that the top and left edge borders. Why is this and can I stop it?

var paper = Raphael(10, 50, 500, 500);
var rect = paper.rect(100, 100, 100, 100);

When I draw a simple rectangle using the following code the bottom and right edge borders are thicker that the top and left edge borders. Why is this and can I stop it?

var paper = Raphael(10, 50, 500, 500);
var rect = paper.rect(100, 100, 100, 100);
Share Improve this question asked Aug 8, 2012 at 17:08 benshortbenshort 6608 silver badges14 bronze badges 2
  • Are you using an older version of chrome, by any chance -- if not, what browser are you using? I can't reproduce the problem you're describing. – Kevin Nielsen Commented Aug 8, 2012 at 17:14
  • @KevinNielsen I'm using Chrome version 18 but I see it in FF 10.0.4 as well. – benshort Commented Aug 8, 2012 at 19:53
Add a ment  | 

2 Answers 2

Reset to default 6

Your rectangle's top and left borders, which are using the default 1 pixel stroke-width, are falling exactly on the top and left borders of your SVG element (as represented by a Raphael paper object. As opposed to pixel based drawing solutions, this means the line is essentially straddling the element's border, resulting in 0.5 pixels of your border stroke being clipped.

To solve, you simply need to shift your drawing over or shift the beginning offset of your SVG element's coordinates.

Here's a fiddle that shows one solution.

The square looks fine to me: http://jsfiddle/cMXBC/2/

Could you have some rogue css somewhere that is modifying the stroke of the rect? Try right-clicking the square and inspecting the rectangle in Firebug or with the Chrome inspector to see if there is any style that has been added.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745335971a4623105.html

相关推荐

  • javascript - Raphael Rectangle Border - Stack Overflow

    When I draw a simple rectangle using the following code the bottom and right edge borders are thicker t

    7小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信