|
@@ -128,6 +128,8 @@ final class MyProfilePageView: NSView {
|
|
|
/// Below this form content width, two-column rows stack vertically.
|
|
/// Below this form content width, two-column rows stack vertically.
|
|
|
private static let compactFormWidth: CGFloat = 640
|
|
private static let compactFormWidth: CGFloat = 640
|
|
|
private static let horizontalPageInset: CGFloat = 24
|
|
private static let horizontalPageInset: CGFloat = 24
|
|
|
|
|
+ /// Inset of form content from the card border (left/right); explicit constraints so fields stay inside the card chrome.
|
|
|
|
|
+ private static let cardContentHorizontalInset: CGFloat = 28
|
|
|
|
|
|
|
|
private let scrollView = NSScrollView()
|
|
private let scrollView = NSScrollView()
|
|
|
private let documentView = NSView()
|
|
private let documentView = NSView()
|
|
@@ -270,7 +272,7 @@ final class MyProfilePageView: NSView {
|
|
|
formStack.alignment = .leading
|
|
formStack.alignment = .leading
|
|
|
formStack.distribution = .fill
|
|
formStack.distribution = .fill
|
|
|
formStack.spacing = 24
|
|
formStack.spacing = 24
|
|
|
- formStack.edgeInsets = NSEdgeInsets(top: 32, left: 28, bottom: 32, right: 28)
|
|
|
|
|
|
|
+ formStack.edgeInsets = NSEdgeInsets(top: 32, left: 0, bottom: 32, right: 0)
|
|
|
formStack.userInterfaceLayoutDirection = .leftToRight
|
|
formStack.userInterfaceLayoutDirection = .leftToRight
|
|
|
ProfileLayoutEnforcement.applyForcedLTR(to: formStack)
|
|
ProfileLayoutEnforcement.applyForcedLTR(to: formStack)
|
|
|
formStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
formStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
@@ -298,9 +300,8 @@ final class MyProfilePageView: NSView {
|
|
|
cardView.rightAnchor.constraint(equalTo: documentView.rightAnchor, constant: -Self.horizontalPageInset),
|
|
cardView.rightAnchor.constraint(equalTo: documentView.rightAnchor, constant: -Self.horizontalPageInset),
|
|
|
cardView.topAnchor.constraint(equalTo: documentView.topAnchor, constant: Self.horizontalPageInset),
|
|
cardView.topAnchor.constraint(equalTo: documentView.topAnchor, constant: Self.horizontalPageInset),
|
|
|
|
|
|
|
|
- formStack.leftAnchor.constraint(equalTo: cardView.leftAnchor),
|
|
|
|
|
- formStack.rightAnchor.constraint(equalTo: cardView.rightAnchor),
|
|
|
|
|
- formStack.widthAnchor.constraint(equalTo: cardView.widthAnchor),
|
|
|
|
|
|
|
+ formStack.leadingAnchor.constraint(equalTo: cardView.leadingAnchor, constant: Self.cardContentHorizontalInset),
|
|
|
|
|
+ formStack.trailingAnchor.constraint(equalTo: cardView.trailingAnchor, constant: -Self.cardContentHorizontalInset),
|
|
|
formStack.topAnchor.constraint(equalTo: cardView.topAnchor),
|
|
formStack.topAnchor.constraint(equalTo: cardView.topAnchor),
|
|
|
formStack.bottomAnchor.constraint(equalTo: cardView.bottomAnchor)
|
|
formStack.bottomAnchor.constraint(equalTo: cardView.bottomAnchor)
|
|
|
])
|
|
])
|
|
@@ -371,7 +372,7 @@ final class MyProfilePageView: NSView {
|
|
|
private func applyResponsiveRowsIfNeeded() {
|
|
private func applyResponsiveRowsIfNeeded() {
|
|
|
let w = cardView.bounds.width
|
|
let w = cardView.bounds.width
|
|
|
guard w > 1 else { return }
|
|
guard w > 1 else { return }
|
|
|
- let formWidth = max(0, w - formStack.edgeInsets.left - formStack.edgeInsets.right)
|
|
|
|
|
|
|
+ let formWidth = max(0, w - 2 * Self.cardContentHorizontalInset - formStack.edgeInsets.left - formStack.edgeInsets.right)
|
|
|
let compact = formWidth < Self.compactFormWidth
|
|
let compact = formWidth < Self.compactFormWidth
|
|
|
guard compact != lastCompactLayout else { return }
|
|
guard compact != lastCompactLayout else { return }
|
|
|
lastCompactLayout = compact
|
|
lastCompactLayout = compact
|