scala-js / scala-js-dom

Statically typed DOM API for Scala.js
Other
315 stars 160 forks source link

add roundRect #828

Open buntec opened 6 months ago

buntec commented 6 months ago

Hi there!

Before submitting a PR containing any Scala changes, please make sure you...

Thanks for contributing!

buntec commented 6 months ago

Alas, that radii param is a mess to encode (probably why this method was missing in the first place).

zetashift commented 6 months ago

Alas, that radii param is a mess to encode (probably why this method was missing in the first place).

Oh yup, from https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-roundrect

If radii is an unrestricted double or [DOMPointInit] (https://drafts.fxtf.org/geometry/#dictdef-dompointinit), then set radii to « radii ».

If radii is not a list of size one, two, three, or four, then throw a RangeError.

I wonder if we should create a new enum type that encodes this or just stick with Any. What do you think @armanbilge?