aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/utils
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-01-29 23:59:51 +0100
committerRobert Jaros <rjaros@finn.pl>2018-01-29 23:59:51 +0100
commit0c01ee40a27fde99ebc23dd13a5b54ce54a01b0f (patch)
tree9b72e603322591228ef9577cca0d1f7adf556305 /src/main/kotlin/pl/treksoft/kvision/utils
parent2c7ca3f8808935fc0c56458dca54f7bf417141f7 (diff)
downloadkvision-0c01ee40a27fde99ebc23dd13a5b54ce54a01b0f.tar.gz
kvision-0c01ee40a27fde99ebc23dd13a5b54ce54a01b0f.tar.bz2
kvision-0c01ee40a27fde99ebc23dd13a5b54ce54a01b0f.zip
"auto" support in CssSize
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/utils')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
index b426e432..80a7c482 100644
--- a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
@@ -23,6 +23,15 @@ fun Int.vh(): CssSize = Pair(this, UNIT.vh)
fun Int.vw(): CssSize = Pair(this, UNIT.vw)
fun Int.vmin(): CssSize = Pair(this, UNIT.vmin)
fun Int.vmax(): CssSize = Pair(this, UNIT.vmax)
+fun auto(): CssSize = Pair(0, UNIT.auto)
+
+fun CssSize.asString(): String {
+ return if (this.second != UNIT.auto) {
+ this.first.toString() + this.second.unit
+ } else {
+ "auto"
+ }
+}
private val hex = arrayOf("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f")