Fix timeline, details views for proper toolbar scroll behavior

Both the details and timeline container views were not extending behind the toolbar and thus content would not show when scrolled behind it. Top anchors should anchor to the top of the super view rather than safe area guides and AppKit automatically adjusts the scroll insets for NSToolbar and optionally (if available) NSTitlebarAccessoryViewController. This allows for the divider to appear when content scrolls behind it and for content to "shine through" the translucency of the NSToolbar.
This commit is contained in:
Mario Guzman
2022-10-01 12:03:51 -07:00
parent f930eca9bb
commit 1eb4002c78
3 changed files with 32 additions and 37 deletions

View File

@@ -30,11 +30,10 @@ final class DetailContainerView: NSView, NSTextFinderBarContainer {
contentView.translatesAutoresizingMaskIntoConstraints = false
addSubview(contentView, positioned: .below, relativeTo: detailStatusBarView)
// Constrain the content view to fill the available space on all sides except the top, which we'll constrain to the find bar
var constraints = constraintsToMakeSubViewFullSize(contentView).filter { $0.firstAttribute != .top }
// Constrain the content view to fill the available space on all sides
var constraints = constraintsToMakeSubViewFullSize(contentView)
constraints.append(findBarContainerView.topAnchor.constraint(equalTo: self.safeAreaLayoutGuide.topAnchor))
constraints.append(findBarContainerView.bottomAnchor.constraint(equalTo: contentView.topAnchor))
NSLayoutConstraint.activate(constraints)
contentViewConstraints = constraints
}