Bakaburg
Bakaburg

Reputation: 3311

raphael.js close path

I have a problem in closing a path with raphael.js.

Here is my path: M 5 120 A 50,50 0 0,1 18,71 M 18 71 A 50,50 0 0,1 85,93 M 85 93 A 50,50 0 0,1 173,78 M 173 78 A 50,50 0 0,1 213,90 M 213 90 A 50,50 0 0,1 315, 120z

Instead of closing the whole path only the last arc get closed while i want that the whole path get closed with a line to the first point.

any idea?

Upvotes: 0

Views: 942

Answers (1)

Peter Collingridge
Peter Collingridge

Reputation: 10979

The M command moves the path to a new point (e.g. M 18 17 moves to position (18,17)), and starts a new section of the drawing. You can remove all the M commands in your path except the first one as they just move to the point where the path already is (notice the two numbers before an M are the same as the two numbers after it).

Then you should have what you want - a single path that closes properly:

M 5 120 A 50,50 0 0,1 18,71 A 50,50 0 0,1 85,93 A 50,50 0 0,1 173,78 A 50,50 0 0,1 213,90 A 50,50 0 0,1 315, 120z

Upvotes: 3

Related Questions