Skip to content

Commit 963fd40

Browse files
committed
fix(shale): padding causing negative sizes
1 parent 5d38504 commit 963fd40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shale/src/main/kotlin/moe/nea/shale/layout/BoxElement.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class BoxElement : Element() {
1313
growChildElementsAlongAxis()
1414
} else {
1515
val crossAxis = direction.axis.cross
16-
val myHeight = crossAxis.choose(preferredSize) - crossAxis.choose(padding.sizes)
16+
val myHeight = (crossAxis.choose(preferredSize) - crossAxis.choose(padding.sizes)).coerceAtLeast(0)
1717
children.filter { it.sizing is Sizing.GrowFractional }
1818
.forEach {
1919
it.preferredSize = crossAxis.setUnchoosenSize(it.preferredSize, myHeight)

0 commit comments

Comments
 (0)