fix: match notes scroll offsets to compact bars
This commit is contained in:
@@ -1184,6 +1184,9 @@ final class ApplicationCell: NSTableCellView {
|
||||
@MainActor
|
||||
final class LauncherScrollView: NSScrollView {
|
||||
static let fadeHeight: CGFloat = 32
|
||||
var edgeFadeHeight: CGFloat = LauncherScrollView.fadeHeight {
|
||||
didSet { needsLayout = true }
|
||||
}
|
||||
private let edgeFade = CAGradientLayer()
|
||||
|
||||
override init(frame frameRect: NSRect) {
|
||||
@@ -1200,7 +1203,7 @@ final class LauncherScrollView: NSScrollView {
|
||||
|
||||
override func layout() {
|
||||
super.layout()
|
||||
let fade = min(0.5, Self.fadeHeight / max(bounds.height, 1))
|
||||
let fade = min(0.5, edgeFadeHeight / max(bounds.height, 1))
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
edgeFade.frame = bounds
|
||||
|
||||
@@ -120,14 +120,15 @@ final class NotesController: NSViewController, NSTextViewDelegate {
|
||||
editor.textContainerInset = NSSize(width: 22, height: 8)
|
||||
editor.setAccessibilityLabel("Note editor")
|
||||
let scroll = LauncherScrollView()
|
||||
scroll.edgeFadeHeight = 16
|
||||
scroll.documentView = editor
|
||||
scroll.hasVerticalScroller = true
|
||||
scroll.autohidesScrollers = true
|
||||
scroll.drawsBackground = false
|
||||
scroll.scrollerStyle = .overlay
|
||||
scroll.automaticallyAdjustsContentInsets = false
|
||||
scroll.contentInsets = NSEdgeInsets(top: LauncherScrollView.fadeHeight, left: 0,
|
||||
bottom: LauncherScrollView.fadeHeight, right: 0)
|
||||
scroll.contentInsets = NSEdgeInsets(top: scroll.edgeFadeHeight, left: 0,
|
||||
bottom: scroll.edgeFadeHeight, right: 0)
|
||||
status.font = .systemFont(ofSize: 12)
|
||||
status.textColor = SunsetPalette.secondaryText
|
||||
status.setAccessibilityLabel("Notes save status")
|
||||
|
||||
Reference in New Issue
Block a user