Fix status bar color.

This commit is contained in:
Brent Simmons 2018-02-24 11:04:47 -08:00
parent 04c2d57637
commit 53ec85c6bb
3 changed files with 36 additions and 3 deletions

View File

@ -57,8 +57,8 @@ final class SidebarStatusBarView: NSView {
return
}
// let color = NSColor(calibratedWhite: 0.96, alpha: 1.0)
layer.backgroundColor = NSColor.white.cgColor
let color = NSColor(calibratedWhite: 0.96, alpha: 1.0)
layer.backgroundColor = color.cgColor
didConfigureLayer = true
}

View File

@ -76,12 +76,44 @@ struct TimelineCellLayout {
let layout = TimelineCellLayout(width: width, cellData: cellData, appearance: appearance)
return layout.height
}
func adjustedForHeight(_ newHeight: CGFloat) -> TimelineCellLayout {
// When the cell is laying out subviews, the height of the cell is known,
// and that height may not match the ideal height calculated in TimelineCellLayout.
// In that case we may need to adjust the layout.
if abs(newHeight - height) < 0.01 {
return self
}
return TimelineCellLayout(otherLayout: self, height: newHeight)
}
}
// MARK: - Calculate Rects
private extension TimelineCellLayout {
private init(otherLayout: TimelineCellLayout, height: CGFloat) {
self.width = otherLayout.width
self.feedNameRect = otherLayout.feedNameRect
self.dateRect = otherLayout.dateRect
self.titleRect = otherLayout.titleRect
self.numberOfLinesForTitle = otherLayout.numberOfLinesForTitle
self.summaryRect = otherLayout.summaryRect
self.textRect = otherLayout.textRect
self.unreadIndicatorRect = otherLayout.unreadIndicatorRect
self.starRect = otherLayout.starRect
self.paddingBottom = otherLayout.paddingBottom
let bounds = NSRect(x: 0.0, y: 0.0, width: otherLayout.width, height: height)
self.avatarImageRect = RSRectCenteredVerticallyInRect(otherLayout.avatarImageRect, bounds)
self.height = height
}
static func rectForTextBox(_ appearance: TimelineCellAppearance, _ cellData: TimelineCellData, _ width: CGFloat) -> NSRect {
// Returned height is a placeholder. Not needed when this is calculated.

View File

@ -237,7 +237,8 @@ private extension TimelineTableCellView {
func updatedLayoutRects() -> TimelineCellLayout {
return TimelineCellLayout(width: bounds.width, cellData: cellData, appearance: cellAppearance)
let layout = TimelineCellLayout(width: bounds.width, cellData: cellData, appearance: cellAppearance)
return layout.adjustedForHeight(bounds.height)
}
func updateAppearance() {