Skip to content

Commit

Permalink
fix: shortcut tabs right margin
Browse files Browse the repository at this point in the history
  • Loading branch information
decodism authored and lwouis committed Oct 14, 2022
1 parent 9c26d54 commit d207f86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit d207f86

Please sign in to comment.