mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-26 01:22:53 +01:00
Do less work in timeline table cell views, which should make scrolling imperceptibly faster.
This commit is contained in:
parent
6f41b2a728
commit
2ece915ac3
@ -11,6 +11,8 @@ import DB5
|
||||
|
||||
struct TimelineCellAppearance: Equatable {
|
||||
|
||||
let showAvatar: Bool
|
||||
|
||||
let cellPadding: NSEdgeInsets
|
||||
|
||||
let feedNameColor: NSColor
|
||||
@ -45,7 +47,6 @@ struct TimelineCellAppearance: Equatable {
|
||||
let avatarMarginLeft: CGFloat
|
||||
let avatarAdjustmentTop: CGFloat
|
||||
let avatarCornerRadius: CGFloat
|
||||
let showAvatar: Bool
|
||||
|
||||
let boxLeftMargin: CGFloat
|
||||
|
||||
|
@ -32,9 +32,12 @@ class TimelineTableCellView: NSTableCellView {
|
||||
|
||||
var cellAppearance: TimelineCellAppearance! {
|
||||
didSet {
|
||||
updateTextFields()
|
||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||
needsLayout = true
|
||||
if cellAppearance != oldValue {
|
||||
updateTextFieldColors()
|
||||
updateTextFieldFonts()
|
||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||
needsLayout = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,10 +190,10 @@ private extension TimelineTableCellView {
|
||||
|
||||
func updateTextFieldColors() {
|
||||
|
||||
updateTitleView()
|
||||
// updateTitleView()
|
||||
|
||||
if #available(macOS 10.14, *) {
|
||||
makeTextFieldColorsNormal()
|
||||
//makeTextFieldColorsNormal()
|
||||
}
|
||||
else {
|
||||
// Pre-Mojave: manually set colors to white when needed.
|
||||
@ -220,12 +223,6 @@ private extension TimelineTableCellView {
|
||||
textView.font = cellAppearance.textOnlyFont
|
||||
}
|
||||
|
||||
func updateTextFields() {
|
||||
|
||||
updateTextFieldColors()
|
||||
updateTextFieldFonts()
|
||||
}
|
||||
|
||||
func addSubviewAtInit(_ view: NSView, hidden: Bool) {
|
||||
|
||||
addSubview(view)
|
||||
@ -234,7 +231,6 @@ private extension TimelineTableCellView {
|
||||
}
|
||||
|
||||
func commonInit() {
|
||||
|
||||
addSubviewAtInit(titleView, hidden: false)
|
||||
addSubviewAtInit(summaryView, hidden: true)
|
||||
addSubviewAtInit(textView, hidden: true)
|
||||
@ -243,6 +239,8 @@ private extension TimelineTableCellView {
|
||||
addSubviewAtInit(feedNameView, hidden: true)
|
||||
addSubviewAtInit(avatarImageView, hidden: true)
|
||||
addSubviewAtInit(starView, hidden: true)
|
||||
|
||||
makeTextFieldColorsNormal()
|
||||
}
|
||||
|
||||
func updatedLayoutRects() -> TimelineCellLayout {
|
||||
@ -356,7 +354,6 @@ private extension TimelineTableCellView {
|
||||
}
|
||||
|
||||
func updateSubviews() {
|
||||
|
||||
updateTitleView()
|
||||
updateSummaryView()
|
||||
updateTextView()
|
||||
|
Loading…
Reference in New Issue
Block a user