mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Scroll the selected item into view when it's only partially visible — cells under the column title were counted as visible. Fixes #5107.
This commit is contained in:
1 parent
f3a9bac19e
commit
e9e8b46a48
1 file changed
+7
-2
@@ -24,9 +24,14 @@ extension UICollectionView {
|
||||
|
||||
selectItem(at: indexPath, animated: true, scrollPosition: [])
|
||||
|
||||
if !indexPathsForVisibleItems.contains(indexPath) {
|
||||
scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
|
||||
// indexPathsForVisibleItems includes cells hidden under the bars —
|
||||
// check the unobscured region instead.
|
||||
// <https://github.com/Ranchero-Software/NetNewsWire/issues/5107>
|
||||
let unobscuredBounds = bounds.inset(by: adjustedContentInset)
|
||||
if let itemFrame = layoutAttributesForItem(at: indexPath)?.frame, unobscuredBounds.contains(itemFrame) {
|
||||
return
|
||||
}
|
||||
scrollToItem(at: indexPath, at: .centeredVertically, animated: true)
|
||||
}
|
||||
|
||||
public func middleVisibleRow() -> IndexPath? {
|
||||
|
||||
Reference in new issue
Block a user