Skip to content

Commit

Permalink
Fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii committed Sep 10, 2022
1 parent 196a47d commit 677a931
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/WrapLayout/WrapLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public struct WrapLayout: Layout {

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

if (calculatedSize.width + offsetX) >= bounds.width {
if (calculatedSize.width + offsetX + horizontalSpacing) >= bounds.width {
// line break
currentLine.width = offsetX

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

currentLine.elements.append(calculatedElement)

offsetX += calculatedSize.width + horizontalSpacing
offsetX += calculatedSize.width

if currentLine.height < calculatedElement.size.height {
currentLine.height = calculatedElement.size.height
}

}

currentLine.width = offsetX
cache.lines.append(currentLine)

let size = cache.calculateSize(verticalSpacing: verticalSpacing)
Expand Down

0 comments on commit 677a931

Please sign in to comment.