paths-js
paths-js copied to clipboard
Circular arc command as part of low level api?
Hey @andreaferretti, I think it would be really nice if users could define a circular arc with a slightly simplified api:
.arcCircular(xCenter, yCenter, r, sAngle, eAngle, counterclockwise)
This api mirrors the canvas arc api and I think it is a lot more straightforward for this particular use case. http://www.w3schools.com/tags/canvas_arc.asp
What do you think?
I'd be happy to try to implement it myself, but am a little confused as to whether I should be modifying the path.coffee file or the one under the node dir?
Thanks for the great library!
I think the right place to put such an API - which is certainly welcome! - would be the Mid Level API. The Low Level one intentionally mimcs the SVG spec literally, and I'd rather not deviate. One could have instead a Shape called CircleArc or something like that, with your parameters, that draws a circular arc.
If you want to submit a PR, you could create a file like circle-arc.coffee under /src/main/paths, together with some tests in /src/tests. The node files are created by grunt. For an example, you can look at another shape, such as polygon.coffee.
To check that everything is fine and run the tests, you first need to install grunt (npm install -g grunt-cli), then
npm install
grunt
Hope that helps!
Great thanks for the info. I'll do it if I have time!
On Mon, Nov 2, 2015, 12:59 AM Andrea Ferretti [email protected] wrote:
I think the right place to put such an API - which is certainly welcome! - would be the Mid Level API. The Low Level one intentionally mimcs the SVG spec literally, and I'd rather not deviate. One could have instead a Shape called CircleArc or something like that, with your parameters, that draws a circular arc.
If you want to submit a PR, you could create a file like circle-arc.coffee under /src/main/paths, together with some tests in /src/tests. The node files are created by grunt http://gruntjs.com/. For an example, you can look at another shape, such as polygon.coffee.
To check that everything is fine and run the tests, you first need to install grunt (npm install -g grunt-cli), then
npm install grunt
Hope that helps!
— Reply to this email directly or view it on GitHub https://github.com/andreaferretti/paths-js/issues/29#issuecomment-152960604 .
Just in case, now there is no need for grunt anymore. Just npm install, npm run build, npm run test