aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/utils
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-03-08 13:34:55 +0100
committerRobert Jaros <rjaros@finn.pl>2018-03-08 13:34:55 +0100
commitb4a797930cc1a023c18f247fb0e2698ba14dad1f (patch)
treead2e444e5aeeac2b9f222ce30bbb40395509cb46 /src/main/kotlin/pl/treksoft/kvision/utils
parent19906e0305e054c1d951705335a61d41949565f4 (diff)
downloadkvision-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')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt13
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
}
}