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
17
17
CGSize _adjustmentSize1 ;
18
18
CGSize _currentSize ;
19
19
20
+ const double ConstraintSizeTolerance = 0.00001 ;
21
+
20
22
Dictionary < object , CGSize > _cellSizeCache = new Dictionary < object , CGSize > ( ) ;
21
23
22
24
public ItemsUpdatingScrollMode ItemsUpdatingScrollMode { get ; set ; }
@@ -88,7 +90,7 @@ protected virtual void HandlePropertyChanged(PropertyChangedEventArgs propertyCh
88
90
89
91
internal virtual void UpdateConstraints ( CGSize size )
90
92
{
91
- if ( size == _currentSize )
93
+ if ( ! RequiresConstraintUpdate ( size , _currentSize ) )
92
94
{
93
95
return ;
94
96
}
@@ -588,5 +590,20 @@ internal void ClearCellSizeCache()
588
590
{
589
591
_cellSizeCache . Clear ( ) ;
590
592
}
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
+ }
591
608
}
592
609
}
You can’t perform that action at this time.
0 commit comments