Skip to content

Commit

Permalink
Merge pull request #785 from Wisors/master
Browse files Browse the repository at this point in the history
Fix float precision bug during offset calculation
  • Loading branch information
wiruzx authored Aug 30, 2023
2 parents 16af6a4 + 3960a1d commit 0b5459d
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 0b5459d

Please sign in to comment.