fix: scrollbar works with all system preferences options (closes #196)
This commit is contained in:
1 parent
51ad28dc09
commit
3289d3ad99
1 file changed
+6
-4
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user