File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,13 +152,15 @@ struct FlowLayout: Sendable {
152152 cache: FlowLayoutCache
153153 ) -> Lines {
154154 let items : LineBreakingInput = subviews. enumerated ( ) . map { offset, subview in
155- let size : ClosedRange < CGFloat >
155+ let minValue : CGFloat
156156 let subviewCache = cache. subviewsCache [ offset]
157157 if subviewCache. ideal. breadth <= proposedSize. value ( on: axis) {
158- size = subviewCache. ideal. breadth ... subviewCache . max . breadth
158+ minValue = subviewCache. ideal. breadth
159159 } else {
160- size = subview. sizeThatFits ( proposedSize) . value ( on: axis) ... subviewCache . max . breadth
160+ minValue = subview. sizeThatFits ( proposedSize) . value ( on: axis)
161161 }
162+ let maxValue = subviewCache. max. breadth
163+ let size = min ( minValue, maxValue) ... max ( minValue, maxValue)
162164 let spacing = itemSpacing ?? (
163165 offset > cache. subviewsCache. startIndex
164166 ? cache. subviewsCache [ offset - 1 ] . spacing. distance ( to: subviewCache. spacing, along: axis)
You can’t perform that action at this time.
0 commit comments