diff --git a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt index f5a1d98fd0..481e920c0c 100644 --- a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt +++ b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt @@ -67,16 +67,16 @@ interface SplitterScope { * Size of handle will have no effect on split pane parts (first and second) sizes. * * @param alignment alignment of handle according to [visiblePart] could be: - * * [SplitterHandleAlign.BEFORE] if you place handle before [visiblePart], - * * [SplitterHandleAlign.ABOVE] if you place handle above [visiblePart] (will be centered) - * * and [SplitterHandleAlign.AFTER] if you place handle after [visiblePart]. + * * [SplitterHandleAlignment.BEFORE] if you place handle before [visiblePart], + * * [SplitterHandleAlignment.ABOVE] if you place handle above [visiblePart] (will be centered) + * * and [SplitterHandleAlignment.AFTER] if you place handle after [visiblePart]. * * @param content composable item content provider. Uses [HandleScope] to allow mark any provided composable part * as handle. * [content] will be placed only if [SplitPaneState.moveEnabled] is true */ fun handle( - alignment: SplitterHandleAlign = SplitterHandleAlign.ABOVE, + alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE, content: @Composable HandleScope.() -> Unit ) } @@ -105,7 +105,7 @@ internal class SplitterScopeImpl( } override fun handle( - alignment: SplitterHandleAlign, + alignment: SplitterHandleAlignment, content: @Composable HandleScope.() -> Unit ) { containerScope.handle = { HandleScopeImpl(containerScope).content() } @@ -134,7 +134,7 @@ internal class SplitPaneScopeImpl( internal lateinit var visiblePart: ComposableSlot internal lateinit var handle: ComposableSlot - internal var alignment: SplitterHandleAlign = SplitterHandleAlign.ABOVE + internal var alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE internal val splitter get() = if (this::visiblePart.isInitialized && this::handle.isInitialized) { diff --git a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/Splitter.kt b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/Splitter.kt index a16b69d94b..436df94f9e 100644 --- a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/Splitter.kt +++ b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/Splitter.kt @@ -3,7 +3,7 @@ package org.jetbrains.compose.splitpane import androidx.compose.runtime.Composable @ExperimentalSplitPaneApi -enum class SplitterHandleAlign { +enum class SplitterHandleAlignment { BEFORE, ABOVE, AFTER @@ -13,5 +13,5 @@ enum class SplitterHandleAlign { internal data class Splitter( val measuredPart: @Composable () -> Unit, val handlePart: @Composable () -> Unit = measuredPart, - val align: SplitterHandleAlign = SplitterHandleAlign.ABOVE + val alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE ) diff --git a/components/SplitPane/common/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitPane.kt b/components/SplitPane/common/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitPane.kt index ceaebcf3dc..67c61e9f8e 100644 --- a/components/SplitPane/common/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitPane.kt +++ b/components/SplitPane/common/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitPane.kt @@ -113,10 +113,10 @@ internal actual fun SplitPane( val handlePlaceable = measurables[3].measure(constraints) val handleSize = handlePlaceable.valueByDirection(isHorizontal) // TODO support RTL - val handlePosition = when (splitter.align) { - SplitterHandleAlign.BEFORE -> constrainedPosition - handleSize - SplitterHandleAlign.ABOVE -> constrainedPosition + (splitterSize - handleSize) / 2 - SplitterHandleAlign.AFTER -> constrainedPosition + splitterSize + handleSize + val handlePosition = when (splitter.alignment) { + SplitterHandleAlignment.BEFORE -> constrainedPosition + splitterSize - handleSize + SplitterHandleAlignment.ABOVE -> constrainedPosition + (splitterSize - handleSize) / 2 + SplitterHandleAlignment.AFTER -> constrainedPosition } layout(constraints.maxWidth, constraints.maxHeight) {