mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Compare commits
No commits in common. "9f8f3a6ecfd5ebaaa20addec730da6cbf5c9b6f7" and "7d0c50a8b71fcc25ae3adee08a8ab4347e2b7b80" have entirely different histories.
9f8f3a6ecf
...
7d0c50a8b7
@ -14,7 +14,7 @@ class AlbumViewItem: NSCollectionViewItem {
|
|||||||
|
|
||||||
override var isSelected: Bool {
|
override var isSelected: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
setAppearance(selected: isSelected)
|
albumCoverBox.layer?.borderWidth = isSelected ? 5 : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,20 +22,18 @@ class AlbumViewItem: NSCollectionViewItem {
|
|||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
albumCoverView.wantsLayer = true
|
albumCoverView.wantsLayer = true
|
||||||
albumCoverView.layer?.backgroundColor = NSColor.black.cgColor
|
albumCoverView.layer?.cornerRadius = 3
|
||||||
albumCoverView.layer?.cornerRadius = 4
|
|
||||||
albumCoverView.layer?.borderWidth = 1
|
albumCoverView.layer?.borderWidth = 1
|
||||||
albumCoverView.layer?.masksToBounds = true
|
|
||||||
|
|
||||||
albumCoverBox.wantsLayer = true
|
albumCoverBox.wantsLayer = true
|
||||||
albumCoverBox.layer?.cornerRadius = 7
|
albumCoverBox.layer?.cornerRadius = 5
|
||||||
albumCoverBox.layer?.borderWidth = 5
|
albumCoverBox.layer?.borderWidth = 0
|
||||||
|
|
||||||
setAppearance(selected: false)
|
setAppearance()
|
||||||
|
|
||||||
if #available(OSX 10.14, *) {
|
if #available(OSX 10.14, *) {
|
||||||
observer = NSApp.observe(\.effectiveAppearance) { (app, _) in
|
observer = NSApp.observe(\.effectiveAppearance) { (app, _) in
|
||||||
self.setAppearance(selected: false)
|
self.setAppearance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,22 +57,16 @@ class AlbumViewItem: NSCollectionViewItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setAppearance(selected isSelected: Bool) {
|
func setAppearance() {
|
||||||
guard let viewLayer = albumCoverView.layer,
|
|
||||||
let boxLayer = albumCoverBox.layer
|
|
||||||
else { return }
|
|
||||||
|
|
||||||
if #available(OSX 10.14, *) {
|
if #available(OSX 10.14, *) {
|
||||||
let darkMode = NSApp.effectiveAppearance.bestMatch(from:
|
let darkMode = NSApp.effectiveAppearance.bestMatch(from:
|
||||||
[.darkAqua, .aqua]) == .darkAqua
|
[.darkAqua, .aqua]) == .darkAqua
|
||||||
|
|
||||||
viewLayer.borderColor = darkMode ? .albumBorderColorDark : .albumBorderColorLight
|
albumCoverView.layer?.borderColor = darkMode ? .albumBorderColorDark : .albumBorderColorLight
|
||||||
boxLayer.borderColor = isSelected ? NSColor.controlAccentColor.cgColor : CGColor.clear
|
albumCoverBox.layer?.borderColor = NSColor.controlAccentColor.cgColor
|
||||||
boxLayer.backgroundColor = albumCoverBox.layer?.borderColor
|
|
||||||
} else {
|
} else {
|
||||||
viewLayer.borderColor = .albumBorderColorLight
|
albumCoverView.layer?.borderColor = .albumBorderColorLight
|
||||||
boxLayer.borderColor = isSelected ? NSColor.selectedControlColor.cgColor : CGColor.clear
|
albumCoverBox.layer?.borderColor = NSColor.selectedControlColor.cgColor
|
||||||
boxLayer.backgroundColor = albumCoverBox.layer?.borderColor
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
import AppKit
|
import AppKit
|
||||||
|
|
||||||
class AlbumDetailView: NSViewController {
|
class AlbumDetailView: NSViewController {
|
||||||
var observer: NSKeyValueObservation?
|
|
||||||
var album: Album?
|
var album: Album?
|
||||||
var dataSource = AlbumTracksDataSource()
|
var dataSource = AlbumTracksDataSource()
|
||||||
|
|
||||||
@ -31,17 +30,10 @@ class AlbumDetailView: NSViewController {
|
|||||||
albumTracksView.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle
|
albumTracksView.columnAutoresizingStyle = .sequentialColumnAutoresizingStyle
|
||||||
|
|
||||||
albumCoverView.wantsLayer = true
|
albumCoverView.wantsLayer = true
|
||||||
albumCoverView.layer?.backgroundColor = NSColor.black.cgColor
|
albumCoverView.layer?.cornerRadius = 5
|
||||||
albumCoverView.layer?.cornerRadius = 6
|
|
||||||
albumCoverView.layer?.borderWidth = 1
|
albumCoverView.layer?.borderWidth = 1
|
||||||
albumCoverView.layer?.masksToBounds = true
|
|
||||||
setAppearance()
|
setAppearance()
|
||||||
|
|
||||||
if #available(OSX 10.14, *) {
|
|
||||||
observer = NSApp.observe(\.effectiveAppearance) { (app, _) in
|
|
||||||
self.setAppearance()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear() {
|
override func viewWillAppear() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user