Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: shortcut tabs right margin #2011

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ui/preferences-window/LabelAndControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ class TabView: NSTabView, NSTabViewDelegate {
self.init(frame: .zero)
translatesAutoresizingMaskIntoConstraints = false
labelsAndViews.enumerated().forEach { (i, tuple) in
let containerView = NSView()
containerView.addSubview(tuple.1)
containerView.widthAnchor.constraint(greaterThanOrEqualTo: tuple.1.widthAnchor).isActive = true
containerView.heightAnchor.constraint(greaterThanOrEqualTo: tuple.1.heightAnchor).isActive = true
let tab = NSTabViewItem(identifier: i)
tab.label = tuple.0
tab.view = tuple.1
tab.view = containerView
addTabViewItem(tab)
tab.view!.fit()
tuple.1.fit()
}
}
}
1 change: 1 addition & 0 deletions src/ui/preferences-window/tabs/ControlsTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class ControlsTab {
grid.column(at: 0).xPlacement = .trailing
grid.mergeCells(inHorizontalRange: NSRange(location: 0, length: 2), verticalRange: NSRange(location: 0, length: 1))
grid.cell(atColumnIndex: 0, rowIndex: 0).xPlacement = .leading
tabView.rightAnchor.constraint(equalTo: grid.rightAnchor, constant: -GridView.padding).isActive = true

// TODO: better layout logic. Maybe freeze the width of the preference window and have labels wrap on multiple lines
// currently this looks bad if the right column inside the tabView is larger than the right column of the top gridView
Expand Down