-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
roundRect requiring an array #20
Comments
That was already brought in whatwg/html#5619 (comment) which didn't receive much returns, in either ways. FWIW, I personally don't have a strong opinion on this, with a small preference for a single Array, as I feel it is cleaner to have a single signature, and that very long signatures were actually not a great design decision (over the years I often wondered if having a dictionary for drawImage wouldn't have made it more friendly). If you are that much fighting against GC, I guess you could simply store that Array somewhere and reuse it every frame, like you probably already do with a lot of other objects. |
I'm fine with it too. @mysteryDate wdyt? |
I've actually had this on my todo list for a while. I totally agree with a single number for ergonomic reasons, didn't think abuot the garbage collector. |
@mysteryDate I just did update my polyfill to include this single radius option, however doing so I noticed that the current Chrome's implementation has some weird behavior with some stoopid inputs. I'm not an IDL expert myself, but I believe that the JS value Also the behavior of an Array as the first member of a list in radii seems similarly broken: Here is a fiddle with these observations you can check: https://jsfiddle.net/oxvqm597/ Could you please confirm that my reading is correct? |
Closing this as we merged it! Thanks a lot for the feedback. :) |
I can see that the new roundRect requires an array to specify the radius, even when the radius is constant among all corners.
Knowing that most of us are fighting the garbage collector constantly, I do not see it smart to force to pass an array with every call of roundRect.
More when other functions in canvas take advantage of the variable number of arguments, like drawImage.
I suggest to allow the radius parameter to be a number.
The text was updated successfully, but these errors were encountered: