|
|
@@ -1149,6 +1149,10 @@ class ViewController: NSViewController {
|
|
1149
|
1149
|
stack.orientation = .vertical
|
|
1150
|
1150
|
stack.spacing = style == .home ? 12 : 16
|
|
1151
|
1151
|
stack.alignment = .centerX
|
|
|
1152
|
+ stack.distribution = .fill
|
|
|
1153
|
+ // Keep sidebar items pinned to the top; don't let extra height stretch/shift them.
|
|
|
1154
|
+ stack.setContentHuggingPriority(.required, for: .vertical)
|
|
|
1155
|
+ stack.setContentCompressionResistancePriority(.required, for: .vertical)
|
|
1152
|
1156
|
stack.translatesAutoresizingMaskIntoConstraints = false
|
|
1153
|
1157
|
sidebar.addSubview(stack)
|
|
1154
|
1158
|
|
|
|
@@ -1160,6 +1164,13 @@ class ViewController: NSViewController {
|
|
1160
|
1164
|
row.layer?.backgroundColor = selectedRow ? sidebarActiveBackground.withAlphaComponent(0.95).cgColor : NSColor.clear.cgColor
|
|
1161
|
1165
|
row.layer?.cornerRadius = style == .home ? 12 : 10
|
|
1162
|
1166
|
row.widthAnchor.constraint(equalToConstant: style == .home ? 68 : 70).isActive = true
|
|
|
1167
|
+ // Prevent rows from stretching/collapsing when the window resizes.
|
|
|
1168
|
+ row.setContentHuggingPriority(.required, for: .vertical)
|
|
|
1169
|
+ row.setContentCompressionResistancePriority(.required, for: .vertical)
|
|
|
1170
|
+ if style == .home {
|
|
|
1171
|
+ // Must be tall enough for icon (26) + paddings + label without clipping.
|
|
|
1172
|
+ row.heightAnchor.constraint(equalToConstant: 66).isActive = true
|
|
|
1173
|
+ }
|
|
1163
|
1174
|
|
|
1164
|
1175
|
if style == .home {
|
|
1165
|
1176
|
let iconContainer = NSView()
|
|
|
@@ -1237,7 +1248,11 @@ class ViewController: NSViewController {
|
|
1237
|
1248
|
if style == .home {
|
|
1238
|
1249
|
let spacer = NSView()
|
|
1239
|
1250
|
spacer.translatesAutoresizingMaskIntoConstraints = false
|
|
1240
|
|
- spacer.heightAnchor.constraint(greaterThanOrEqualToConstant: 12).isActive = true
|
|
|
1251
|
+ // Keep sidebar icons at the same vertical positions even when the window grows.
|
|
|
1252
|
+ // A flexible spacer will expand with height and push icons away from their default placement.
|
|
|
1253
|
+ spacer.heightAnchor.constraint(equalToConstant: 12).isActive = true
|
|
|
1254
|
+ spacer.setContentHuggingPriority(.required, for: .vertical)
|
|
|
1255
|
+ spacer.setContentCompressionResistancePriority(.required, for: .vertical)
|
|
1241
|
1256
|
stack.addArrangedSubview(spacer)
|
|
1242
|
1257
|
|
|
1243
|
1258
|
let settingsBadge = NSView()
|
|
|
@@ -1274,6 +1289,7 @@ class ViewController: NSViewController {
|
|
1274
|
1289
|
stack.bottomAnchor.constraint(lessThanOrEqualTo: sidebar.bottomAnchor, constant: -18).isActive = true
|
|
1275
|
1290
|
} else {
|
|
1276
|
1291
|
stack.topAnchor.constraint(equalTo: sidebar.topAnchor, constant: 18).isActive = true
|
|
|
1292
|
+ stack.bottomAnchor.constraint(lessThanOrEqualTo: sidebar.bottomAnchor, constant: -18).isActive = true
|
|
1277
|
1293
|
}
|
|
1278
|
1294
|
|
|
1279
|
1295
|
return sidebar
|