diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-03-08 13:34:55 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-03-08 13:34:55 +0100 |
commit | b4a797930cc1a023c18f247fb0e2698ba14dad1f (patch) | |
tree | ad2e444e5aeeac2b9f222ce30bbb40395509cb46 /src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt | |
parent | 19906e0305e054c1d951705335a61d41949565f4 (diff) | |
download | kvision-b4a797930cc1a023c18f247fb0e2698ba14dad1f.tar.gz kvision-b4a797930cc1a023c18f247fb0e2698ba14dad1f.tar.bz2 kvision-b4a797930cc1a023c18f247fb0e2698ba14dad1f.zip |
Support for text, font and position float CSS properties.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt index a25d8e06..d638f79e 100644 --- a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt +++ b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt @@ -148,13 +148,18 @@ val Int.vmax: CssSize val auto: CssSize = Pair(0, UNIT.auto) /** + * Helper property to describe CSS normal value. + */ +val normal: CssSize = Pair(0, UNIT.normal) + +/** * Extension function to convert CssSize to String. */ fun CssSize.asString(): String { - return if (this.second != UNIT.auto) { - this.first.toString() + this.second.unit - } else { - "auto" + return when (this.second) { + UNIT.auto -> "auto" + UNIT.normal -> "normal" + else -> this.first.toString() + this.second.unit } } |