Просмотр исходного кода

Fix profile form horizontal inset inside card

Pin the profile form stack to the card with explicit leading and trailing
constraints instead of relying on NSStackView edge insets alone, so labels
and fields stay inside the card border. Keep vertical stack insets and
update compact layout width math for the new horizontal inset.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 недель назад: 3
Родитель
Сommit
9d266d9064
1 измененных файлов с 6 добавлено и 5 удалено
  1. 6 5
      App for Indeed/Views/MyProfilePageView.swift

+ 6 - 5
App for Indeed/Views/MyProfilePageView.swift

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