diff options
author | Robert Jaros <rjaros@finn.pl> | 2020-03-27 18:31:21 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2020-03-27 18:31:21 +0100 |
commit | b608521b89063e39632a3462a0585184be0dbbf5 (patch) | |
tree | cfd8c7e73b75c355d2d4bcf276627208e4195a36 /src/main | |
parent | 9e9dc5f75b503def28a814f448f1c366e23c922b (diff) | |
download | kvision-b608521b89063e39632a3462a0585184be0dbbf5.tar.gz kvision-b608521b89063e39632a3462a0585184be0dbbf5.tar.bz2 kvision-b608521b89063e39632a3462a0585184be0dbbf5.zip |
Small fix to the flex panel internal margins
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index 436ade22..4cdbfa01 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -105,22 +105,27 @@ open class FlexPanel( * CSS flexbox direction. */ var direction by refreshOnUpdate(direction) { refreshSpacing(); refresh() } + /** * CSS flexbox wrap mode. */ var wrap by refreshOnUpdate(wrap) + /** * CSS flexbox content justification. */ var justify by refreshOnUpdate(justify) + /** * CSS flexbox items alignment. */ var alignItems by refreshOnUpdate(alignItems) + /** * CSS flexbox content alignment. */ var alignContent by refreshOnUpdate(alignContent) + /** * The spacing between columns/rows. */ @@ -163,9 +168,13 @@ open class FlexPanel( spacing?.let { when (direction) { FlexDir.COLUMN -> wrapper.marginBottom = it.px - FlexDir.ROWREV -> wrapper.marginLeft = it.px + FlexDir.ROWREV -> { + if (justify == FlexJustify.FLEXEND) wrapper.marginRight = it.px else wrapper.marginLeft = it.px + } FlexDir.COLUMNREV -> wrapper.marginTop = it.px - else -> wrapper.marginRight = it.px + else -> { + if (justify == FlexJustify.FLEXEND) wrapper.marginLeft = it.px else wrapper.marginRight = it.px + } } } return wrapper |