This repository was archived by the owner on May 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Xamarin.Forms.Platform.iOS/CollectionView Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ public abstract class ItemsViewLayout : UICollectionViewFlowLayout
1717 CGSize _adjustmentSize1 ;
1818 CGSize _currentSize ;
1919
20+ const double ConstraintSizeTolerance = 0.00001 ;
21+
2022 Dictionary < object , CGSize > _cellSizeCache = new Dictionary < object , CGSize > ( ) ;
2123
2224 public ItemsUpdatingScrollMode ItemsUpdatingScrollMode { get ; set ; }
@@ -88,7 +90,7 @@ protected virtual void HandlePropertyChanged(PropertyChangedEventArgs propertyCh
8890
8991 internal virtual void UpdateConstraints ( CGSize size )
9092 {
91- if ( size == _currentSize )
93+ if ( ! RequiresConstraintUpdate ( size , _currentSize ) )
9294 {
9395 return ;
9496 }
@@ -588,5 +590,20 @@ internal void ClearCellSizeCache()
588590 {
589591 _cellSizeCache . Clear ( ) ;
590592 }
593+
594+ bool RequiresConstraintUpdate ( CGSize newSize , CGSize current )
595+ {
596+ if ( Math . Abs ( newSize . Width - current . Width ) > ConstraintSizeTolerance )
597+ {
598+ return true ;
599+ }
600+
601+ if ( Math . Abs ( newSize . Height - current . Height ) > ConstraintSizeTolerance )
602+ {
603+ return true ;
604+ }
605+
606+ return false ;
607+ }
591608 }
592609}
You can’t perform that action at this time.
0 commit comments