- From: Justin Novosad <junov@google.com>
- Date: Mon, 16 Nov 2015 12:02:59 -0500
- To: WHAT Working Group <whatwg@whatwg.org>
Hi All,
The text in the spec:
<snip>
The closePath() method must do nothing if the object's path has no
subpaths. Otherwise, it must mark the last subpath as closed, create a new
subpath whose first point is the same as the previous subpath's first
point, and finally add this new subpath to the path.
Note: If the last subpath had more than one point in its list of points,
then this is equivalent to adding a straight line connecting the last point
back to the first point, thus "closing" the shape, and then repeating the
last (possibly implied) moveTo() call.
</snip>
Problematic use case:
ctx.moveTo(9.8255,71.1829);
ctx.lineTo(103,25);
ctx.lineTo(118,25);
ctx.moveTo(9.8255,71.1829);
ctx.closePath();
ctx.stroke();
Should this draw a closed triangle or two connected line segments?
According to the "Note" (or at least my interpretation of it), this should
draw a closed triangle. But it appears that this is not what many browsers
have implemented. Chrome recently became compliant (or what I think is
compliant), and the change in behavior was reported as a regression.
Thoughts?
- Justin
Received on Monday, 16 November 2015 17:03:34 UTC