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

SVG circle cx, cy attributes dont support string #596

Closed
evbo opened this issue Sep 22, 2022 · 1 comment · Fixed by #617
Closed

SVG circle cx, cy attributes dont support string #596

evbo opened this issue Sep 22, 2022 · 1 comment · Fixed by #617
Labels
Milestone

Comments

@evbo
Copy link

evbo commented Sep 22, 2022

One use case for drawing a circle is to set cx and cy both to 50% and then it will be centered without using a viewbox, but that results in:

[error] |None of the overloaded alternatives of method := in object cy with types
[error] | (v: Option[Double]): slinky.core.OptionalAttrPair[slinky.web.svg._cy_attr.type]
[error] | (v: Double): slinky.core.AttrPair[slinky.web.svg._cy_attr.type]
[error] |match arguments (("50%" : String))
[error] two errors found

Here's that use case, work around is to use viewbox:
https://stackoverflow.com/a/19561100/1080804

@shadaj
Copy link
Owner

shadaj commented Sep 27, 2022

Ah, that's definitely a bug. Would you mind putting together a PR to update the type of cx and cy (in svg.json) to be js.Any? That way users can pass in strings in addition to numbers.

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

Successfully merging a pull request may close this issue.

2 participants