joakin / elm-canvas

A canvas drawing library for Elm
https://package.elm-lang.org/packages/joakin/elm-canvas/latest/
BSD 3-Clause "New" or "Revised" License
163 stars 30 forks source link

Added roundRect support #41

Open fgerodez opened 1 year ago

fgerodez commented 1 year ago

Hi,

This is a pull request that exposes the new roundRect method.

As it is not currently supported on firefox I was wondering if we should add a warning in the usage section of the readme to link to a polyfill such as this one

mbylstra commented 3 months ago

@joakin Would you consider approving this PR? Although I think @shamansir's suggestions are good, I also think the list of float's API in this PR is totally adequate, not a deal breaker - not something that needs to hold up the PR for several more years.

mbylstra commented 3 months ago

I have tested this branch locally by linking in the elm.json "src" - it is working well

joakin commented 3 months ago

@mbylstra sure, I'll have a look in the next two weeks, I'm on vacation without a computer right now.

The PR looks good but I'd like to specify the radii in Canvas.elm in a more type safe way like @shamansir suggested. Maybe just having the radii be a record of { topLeft, topRight, bottomLeft, bottomRight } would work fine, no need to over complicate the API.

Another option is to have roundRect take a single Float for all radii which is the most common case, and have a nother roundRectCustom or something like that that takes the record with the four corners.

mbylstra commented 3 months ago

Sound good! Please enjoy your vacation and take a break from coding 😄