Skip to content

Commit 8a53df4

Browse files
committed
Stop empty stacks ending up with negative spacing (which led to negative size)
1 parent 720ae93 commit 8a53df4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SwiftCrossUI/LayoutSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public enum LayoutSystem {
7070
let visibleChildrenCount = isHidden.count { hidden in
7171
!hidden
7272
}
73-
let totalSpacing = (visibleChildrenCount - 1) * spacing
73+
let totalSpacing = max(visibleChildrenCount - 1, 0) * spacing
7474
let proposedSizeWithoutSpacing = SIMD2(
7575
proposedSize.x - (orientation == .horizontal ? totalSpacing : 0),
7676
proposedSize.y - (orientation == .vertical ? totalSpacing : 0)

0 commit comments

Comments
 (0)