fix: scrollbar works with all system preferences options (closes #196)

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-04-09 14:56:14 +09:00
1 parent 51ad28dc09
commit 3289d3ad99
1 file changed
+6 -4
+6 -4
View File
@@ -94,12 +94,14 @@ class ScrollView: NSScrollView {
hasVerticalScroller = true
scrollerStyle = .overlay
scrollerKnobStyle = .light
forceOverlayStyle()
}
// draw the scroller on top of the content
override func tile() {
super.tile()
contentView.frame = bounds
// force overlay style after a change in System Preference > General > Show scroll bars
private func forceOverlayStyle() -> NSObjectProtocol {
NotificationCenter.default.addObserver(forName: NSScroller.preferredScrollerStyleDidChangeNotification, object: nil, queue: nil) { [weak self] _ in
self?.scrollerStyle = .overlay
}
}
}