Skip to content

Commit

Permalink
Merge pull request #1 from Wisors/Wisors-fix-contentOffset-float-prec…
Browse files Browse the repository at this point in the history
…ision-bug

Fix float precision bug during offset calculation
  • Loading branch information
Wisors authored Aug 29, 2023
2 parents 16af6a4 + a68e659 commit 3960a1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Chatto/sources/ChatController/BaseChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ public final class BaseChatViewController: UIViewController {
let diff = lastUsedBounds.height - collectionView.bounds.height
// When collectionView is scrolled to bottom and height increases,
// collectionView adjusts its contentOffset automatically
let isScrolledToBottom = contentSize.height <= collectionView.bounds.maxY - collectionView.contentInset.bottom
let currentBottomPosition = collectionView.bounds.maxY - collectionView.contentInset.bottom
let isScrolledToBottom = contentSize.height - currentBottomPosition <= CGFloat.bma_epsilon
return isScrolledToBottom ? max(0, diff) : diff
}()
self.previousBoundsUsedForInsetsAdjustment = collectionView.bounds
Expand Down

0 comments on commit 3960a1d

Please sign in to comment.