Reputation: 11828
I have this code:
context.lineWidth = 10;
context.lineCap = "square";
context.lineJoin = "square";
context.strokeRect(x, y, w, h);
lineWidth
seems to be working just fine but changing lineCap
and lineJoin
doesn't do anything. The rectangle is still rounded from earlier when I set the lineCap
and lineJoin
to "round"
. Does anyone know why this is?
Upvotes: 1
Views: 918
Reputation: 35309
Its because you need to use miter
for lineJoin
since square
isn't a valid value.
The lineJoin attribute defines the type of corners that UAs will place where two lines meet. The three valid values are bevel, round, and miter.
Also if you're just doing rects, you don't need lineCap
Upvotes: 3