varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.51k stars 66 forks source link

Allow using StyleVariables in calculations #250

Closed bitspittle closed 1 year ago

bitspittle commented 1 year ago

For example: 1.px + SomeLengthVar.value()

Right now this compiles but it breaks.

What it should do is convert into something like calc(1.px + --some-length()).

It should be noted that StyleVariable.value() works by doing a force cast, which is probably why this isn't working.

If we can get it to work directly as is above, that would be great. Back up plan would be to add operator fun overloading to variables directly: 1.px + SomeLengthVar and SomeLengthVar + 1.ps

DennisTsar commented 1 year ago

Fixed in 0.13.11. See: https://github.com/varabyte/kobweb#arithmetic-for-stylevariables-using-calc