slinky icon indicating copy to clipboard operation
slinky copied to clipboard

SVG circle cx, cy attributes dont support string

Open evbo opened this issue 3 years ago • 1 comments

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

evbo avatar Sep 22 '22 22:09 evbo

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.

shadaj avatar Sep 27 '22 22:09 shadaj