From b608521b89063e39632a3462a0585184be0dbbf5 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Fri, 27 Mar 2020 18:31:21 +0100 Subject: Small fix to the flex panel internal margins --- src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit