Skip to content

Commit 677a931

Browse files
committed
Fix spacing
1 parent 196a47d commit 677a931

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/WrapLayout/WrapLayout.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public struct WrapLayout: Layout {
7272

7373
let calculatedSize = view.sizeThatFits(.init(width: bounds.width, height: bounds.height))
7474

75-
if (calculatedSize.width + offsetX) >= bounds.width {
75+
if (calculatedSize.width + offsetX + horizontalSpacing) >= bounds.width {
7676
// line break
7777
currentLine.width = offsetX
7878

@@ -88,14 +88,15 @@ public struct WrapLayout: Layout {
8888

8989
currentLine.elements.append(calculatedElement)
9090

91-
offsetX += calculatedSize.width + horizontalSpacing
91+
offsetX += calculatedSize.width
9292

9393
if currentLine.height < calculatedElement.size.height {
9494
currentLine.height = calculatedElement.size.height
9595
}
9696

9797
}
9898

99+
currentLine.width = offsetX
99100
cache.lines.append(currentLine)
100101

101102
let size = cache.calculateSize(verticalSpacing: verticalSpacing)

0 commit comments

Comments
 (0)