Skip to content

Commit

Permalink
Fix command button panel content alignment
Browse files Browse the repository at this point in the history
Align the entire content to the start of the fill mode axis when there is no scrolling

Closes #10
  • Loading branch information
kirill-grouchnikov committed Jan 8, 2022
1 parent 1d6665c commit 90b13f1
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.ClipOp
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Fill
import androidx.compose.ui.graphics.drawscope.withTransform
import androidx.compose.ui.layout.Layout
Expand Down Expand Up @@ -154,7 +155,7 @@ internal fun AuroraCommandButtonPanel(
iconDisabledFilterStrategy = presentationModel.iconDisabledFilterStrategy
)

Box {
Box(modifier = modifier.fillMaxSize()) {
val stateVertical = rememberScrollState(0)
val stateHorizontal = rememberScrollState(0)

Expand All @@ -171,7 +172,7 @@ internal fun AuroraCommandButtonPanel(
presentationModel.contentPadding.calculateEndPadding(layoutDirection)
val contentTopPadding = presentationModel.contentPadding.calculateTopPadding()
val contentBottomPadding = presentationModel.contentPadding.calculateBottomPadding()
var topLevelModifier = modifier.padding(
var topLevelModifier = Modifier.fillMaxSize().padding(
start = contentStartPadding,
end = contentEndPadding + extraEndPadding,
top = contentTopPadding,
Expand Down Expand Up @@ -351,7 +352,7 @@ private fun getRowFillMeasurePolicy(

val ltr = (layoutDirection == LayoutDirection.Ltr)

layout(width = panelWidth, height = panelHeight) {
layout(width = panelWidth, height = panelHeight.coerceAtLeast(constraints.minHeight)) {
var currPlaceableIndex = 0
var currY = 0
for (groupModel in contentModel.commandGroups) {
Expand Down Expand Up @@ -486,7 +487,7 @@ private fun getColumnFillMeasurePolicy(
}

val ltr = (layoutDirection == LayoutDirection.Ltr)
layout(width = panelWidth, height = panelHeight) {
layout(width = panelWidth.coerceAtLeast(constraints.minWidth), height = panelHeight) {
var currPlaceableIndex = 0
if (ltr) {
var currX = 0
Expand Down

0 comments on commit 90b13f1

Please sign in to comment.