Repository: JetBrains/compose-multiplatform
File: components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitPane.kt (Kotlin)

Code before:
                val constrainedMax =
                    (constraints.maxByDirection(isHorizontal).toFloat() - secondMinSizePx).let {
                        if (it <= 0 || it <= constrainedMin) {
                            constraints.maxByDirection(isHorizontal).toFloat()
                        } else {
                            it
                        }
                    }

                if (minPosition != constrainedMin) {
                    maxPosition = constrainedMin
                }

                if (maxPosition != constrainedMax) {
                    maxPosition =
                        if (firstMinSizePx + secondMinSizePx < constraints.maxByDirection(isHorizontal)) {
                            constrainedMax
                        } else {
                            minPosition
                        }
                }

                val constrainedPosition =
                    (constraints.maxByDirection(isHorizontal) - (firstMinSizePx + secondMinSizePx)).let {
                        if (it > 0f) {
                            (it * positionPercentage).coerceIn(constrainedMin, constrainedMax).roundToInt()
                        } else {
                            constrainedMin.roundToInt()
                        }
                    }


                val firstPlaceable = measurables[0].measure(
                    if (isHorizontal) {
                        constraints.copy(
                            minWidth = 0,
                            maxWidth = constrainedPosition
                        )
                    } else {
                        constraints.copy(
                            minHeight = 0,
                            maxHeight = constrainedPosition
                        )
                    }
                )

                val splitterPlaceable = measurables[1].measure(constraints)
                val splitterSize = splitterPlaceable.valueByDirection(isHorizontal)
                val secondPlaceablePosition = constrainedPosition + splitterSize

                val secondPlaceableSize =

Review comment (suggestion):
For me personally `position = (min + percentage * (max - min)).roundToInt()` is more clear, so we handle percentage only on the handleArea

Code after:
            with(splitPaneState) {
                val firstMeasurable = measurables[0]
                val splitterMeasurable = measurables[1]
                val secondMeasurable = measurables[2]
                val handleMeasurable = measurables[3]

                // Need the size of the splitter to determine the min/max position
                // Constrain the splitter only on the "other" axis
                val splitterConstraints =
                    if (isHorizontal)
                        constraints.withUnconstrainedWidth()
                    else
                        constraints.withUnconstrainedHeight()
                val splitterPlaceable = splitterMeasurable.measure(splitterConstraints)
                val splitterSize = splitterPlaceable.valueByDirection(isHorizontal)

                @Suppress("UnnecessaryVariable")
                val constrainedMin = firstMinSizePx
                val maxConstraintOnMainAxis = constraints.maxByDirection(isHorizontal)
                val constrainedMax = (maxConstraintOnMainAxis - secondMinSizePx - splitterSize)
                    .coerceAtLeast(constrainedMin)

                minPosition = constrainedMin
                maxPosition = constrainedMax

                val position = (constrainedMin * (1-positionPercentage) + constrainedMax * positionPercentage)
                    .roundToInt()

                val firstPlaceable = firstMeasurable.measure(
                    if (isHorizontal) {
                        constraints.copy(
                            minWidth = 0,
                            maxWidth = position
                        )
                    } else {
                        constraints.copy(
                            minHeight = 0,
                            maxHeight = position
                        )
                    }
                )

                val secondPlaceablePosition = position + splitterSize
                val secondAvailableSize = (maxConstraintOnMainAxis - secondPlaceablePosition).coerceAtLeast(0)

                val secondPlaceable = secondMeasurable.measure(
                    if (isHorizontal) {
                        constraints.copy(
                            minWidth = 0,
                            maxWidth = secondAvailableSize
                        )