mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-27 10:02:37 +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 {
|
struct TimelineCellAppearance: Equatable {
|
||||||
|
|
||||||
|
let showAvatar: Bool
|
||||||
|
|
||||||
let cellPadding: NSEdgeInsets
|
let cellPadding: NSEdgeInsets
|
||||||
|
|
||||||
let feedNameColor: NSColor
|
let feedNameColor: NSColor
|
||||||
@ -45,7 +47,6 @@ struct TimelineCellAppearance: Equatable {
|
|||||||
let avatarMarginLeft: CGFloat
|
let avatarMarginLeft: CGFloat
|
||||||
let avatarAdjustmentTop: CGFloat
|
let avatarAdjustmentTop: CGFloat
|
||||||
let avatarCornerRadius: CGFloat
|
let avatarCornerRadius: CGFloat
|
||||||
let showAvatar: Bool
|
|
||||||
|
|
||||||
let boxLeftMargin: CGFloat
|
let boxLeftMargin: CGFloat
|
||||||
|
|
||||||
|
@ -32,11 +32,14 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
|
|
||||||
var cellAppearance: TimelineCellAppearance! {
|
var cellAppearance: TimelineCellAppearance! {
|
||||||
didSet {
|
didSet {
|
||||||
updateTextFields()
|
if cellAppearance != oldValue {
|
||||||
|
updateTextFieldColors()
|
||||||
|
updateTextFieldFonts()
|
||||||
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||||
needsLayout = true
|
needsLayout = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var cellData: TimelineCellData! {
|
var cellData: TimelineCellData! {
|
||||||
didSet {
|
didSet {
|
||||||
@ -187,10 +190,10 @@ private extension TimelineTableCellView {
|
|||||||
|
|
||||||
func updateTextFieldColors() {
|
func updateTextFieldColors() {
|
||||||
|
|
||||||
updateTitleView()
|
// updateTitleView()
|
||||||
|
|
||||||
if #available(macOS 10.14, *) {
|
if #available(macOS 10.14, *) {
|
||||||
makeTextFieldColorsNormal()
|
//makeTextFieldColorsNormal()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Pre-Mojave: manually set colors to white when needed.
|
// Pre-Mojave: manually set colors to white when needed.
|
||||||
@ -220,12 +223,6 @@ private extension TimelineTableCellView {
|
|||||||
textView.font = cellAppearance.textOnlyFont
|
textView.font = cellAppearance.textOnlyFont
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateTextFields() {
|
|
||||||
|
|
||||||
updateTextFieldColors()
|
|
||||||
updateTextFieldFonts()
|
|
||||||
}
|
|
||||||
|
|
||||||
func addSubviewAtInit(_ view: NSView, hidden: Bool) {
|
func addSubviewAtInit(_ view: NSView, hidden: Bool) {
|
||||||
|
|
||||||
addSubview(view)
|
addSubview(view)
|
||||||
@ -234,7 +231,6 @@ private extension TimelineTableCellView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func commonInit() {
|
func commonInit() {
|
||||||
|
|
||||||
addSubviewAtInit(titleView, hidden: false)
|
addSubviewAtInit(titleView, hidden: false)
|
||||||
addSubviewAtInit(summaryView, hidden: true)
|
addSubviewAtInit(summaryView, hidden: true)
|
||||||
addSubviewAtInit(textView, hidden: true)
|
addSubviewAtInit(textView, hidden: true)
|
||||||
@ -243,6 +239,8 @@ private extension TimelineTableCellView {
|
|||||||
addSubviewAtInit(feedNameView, hidden: true)
|
addSubviewAtInit(feedNameView, hidden: true)
|
||||||
addSubviewAtInit(avatarImageView, hidden: true)
|
addSubviewAtInit(avatarImageView, hidden: true)
|
||||||
addSubviewAtInit(starView, hidden: true)
|
addSubviewAtInit(starView, hidden: true)
|
||||||
|
|
||||||
|
makeTextFieldColorsNormal()
|
||||||
}
|
}
|
||||||
|
|
||||||
func updatedLayoutRects() -> TimelineCellLayout {
|
func updatedLayoutRects() -> TimelineCellLayout {
|
||||||
@ -356,7 +354,6 @@ private extension TimelineTableCellView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateSubviews() {
|
func updateSubviews() {
|
||||||
|
|
||||||
updateTitleView()
|
updateTitleView()
|
||||||
updateSummaryView()
|
updateSummaryView()
|
||||||
updateTextView()
|
updateTextView()
|
||||||
|
Loading…
Reference in New Issue
Block a user