mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
feat: Improved marking as read on scroll on macOS
register top visible article when scrolling starts and ignore the ones above that
This commit is contained in:
@@ -141,6 +141,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
|
||||
var articlesWithManuallyChangedReadStatus: Set<Article> = Set()
|
||||
private var firstVisibleRowIndexWhenDraggingBegan: Int = 0
|
||||
|
||||
private var isScrolling = false
|
||||
|
||||
@@ -352,6 +353,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
|
||||
@objc func scrollViewWillStartLiveScroll(notification: Notification){
|
||||
isScrolling = true
|
||||
firstVisibleRowIndexWhenDraggingBegan = tableView.rows(in: tableView.visibleRect).location
|
||||
}
|
||||
|
||||
@objc func scrollViewDidEndLiveScroll(notification: Notification){
|
||||
@@ -365,7 +367,9 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
|
||||
// Mark articles scrolled out of sight at the top as read
|
||||
let firstVisibleRowIndex = tableView.rows(in: tableView.visibleRect).location
|
||||
let unreadArticlesScrolledAway = articles.articlesAbove(position: firstVisibleRowIndex).filter { !$0.status.read && !articlesWithManuallyChangedReadStatus.contains($0) }
|
||||
|
||||
let unreadArticlesScrolledAway = articles.articlesBetween(
|
||||
upperPosition: firstVisibleRowIndexWhenDraggingBegan, lowerPosition: firstVisibleRowIndex).filter { !$0.status.read && !articlesWithManuallyChangedReadStatus.contains($0) }
|
||||
|
||||
if unreadArticlesScrolledAway.isEmpty { return }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user