shadaj/slinky

SVG circle cx, cy attributes dont support string

evbo opened this issue · 1 comments

evbo commented

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

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.