File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ import UIKit
144
144
internal var cachedAttributes = [ CollectionViewSlantedLayoutAttributes] ( )
145
145
/// :nodoc:
146
146
internal var cachedContentSize : CGFloat = 0
147
+ /// :nodoc:
148
+ internal var currentSize : CGSize = CGSize . zero
147
149
148
150
/// :nodoc:
149
151
fileprivate func itemSize( forItemAt indexPath: IndexPath ) -> ( value: CGFloat , isDynamic: Bool ) {
@@ -215,6 +217,7 @@ import UIKit
215
217
cachedAttributes = [ CollectionViewSlantedLayoutAttributes] ( )
216
218
cachedContentSize = 0
217
219
}
220
+
218
221
}
219
222
220
223
// MARK: CollectionViewLayout methods overriding
@@ -231,6 +234,9 @@ extension CollectionViewSlantedLayout {
231
234
232
235
/// :nodoc:
233
236
override open func shouldInvalidateLayout( forBoundsChange newBounds: CGRect ) -> Bool {
237
+ guard newBounds. size != currentSize else {
238
+ return false
239
+ }
234
240
invalidateCache ( )
235
241
return true
236
242
}
@@ -241,8 +247,8 @@ extension CollectionViewSlantedLayout {
241
247
return
242
248
}
243
249
250
+ currentSize = collectionView? . bounds. size ?? CGSize . zero
244
251
let staticMasks = calculatedMasks ( itemSize: max ( itemSize, 0 ) )
245
-
246
252
var position : CGFloat = 0
247
253
248
254
for item in 0 ..< numberOfItems {
You can’t perform that action at this time.
0 commit comments