Skip to content
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

add roundRect #828

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

buntec
Copy link
Contributor

@buntec buntec commented Jan 5, 2024

Hi there!

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

  • run sbt prePR
  • commit changes to api-reports

Thanks for contributing!

@buntec
Copy link
Contributor Author

buntec commented Jan 5, 2024

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

@zetashift
Copy link
Contributor

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?

Comment on lines +172 to +173
/** Creates a path for a rounded rectangle with a specified position, width, height, and corner radii. */
def roundRect(x: Double, y: Double, w: Double, h: Double, radii: js.Any): Unit = js.native
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Instead of js.Any can we add several overloads of this method for the various types of radii?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants