From f9398d1ae7da496d3a290d7b225225d70a4bb174 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 3 Jun 2019 18:31:49 +0200 Subject: Refactor support for additional attributes from Tag up to the Widget class. --- src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt | 6 +++--- src/main/kotlin/pl/treksoft/kvision/panel/Root.kt | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/panel') diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt index 310d4d49..010f7cba 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/FlexPanel.kt @@ -24,7 +24,7 @@ package pl.treksoft.kvision.panel import pl.treksoft.kvision.core.Component import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.StringPair -import pl.treksoft.kvision.core.StyledComponent +import pl.treksoft.kvision.core.Widget import pl.treksoft.kvision.core.WidgetWrapper import pl.treksoft.kvision.utils.px @@ -152,10 +152,10 @@ open class FlexPanel( } private fun refreshSpacing() { - getChildren().filterIsInstance().map { applySpacing(it) } + getChildren().filterIsInstance().map { applySpacing(it) } } - private fun applySpacing(wrapper: StyledComponent): StyledComponent { + private fun applySpacing(wrapper: Widget): Widget { wrapper.marginTop = null wrapper.marginRight = null wrapper.marginBottom = null diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt index dd3d39b6..2d9dcc46 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/Root.kt @@ -71,7 +71,6 @@ class Root( } roots.add(this) if (isFirstRoot) { - Style.styles.forEach { it.parent = this } Modal.modals.forEach { it.parent = this } } @Suppress("LeakingThis") @@ -102,9 +101,8 @@ class Root( private fun stylesVNodes(): Array { return if (isFirstRoot) { - val visibleStyles = Style.styles.filter { it.visible } - if (visibleStyles.isNotEmpty()) { - val stylesDesc = visibleStyles.joinToString("\n") { it.generateStyle() } + if (Style.styles.isNotEmpty()) { + val stylesDesc = Style.styles.joinToString("\n") { it.generateStyle() } arrayOf(h("style", arrayOf(stylesDesc))) } else { arrayOf() -- cgit