소스 검색

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 주 전
부모
커밋
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
     /// Below this form content width, two-column rows stack vertically.
128
     /// Below this form content width, two-column rows stack vertically.
129
     private static let compactFormWidth: CGFloat = 640
129
     private static let compactFormWidth: CGFloat = 640
130
     private static let horizontalPageInset: CGFloat = 24
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
     private let scrollView = NSScrollView()
134
     private let scrollView = NSScrollView()
133
     private let documentView = NSView()
135
     private let documentView = NSView()
@@ -270,7 +272,7 @@ final class MyProfilePageView: NSView {
270
         formStack.alignment = .leading
272
         formStack.alignment = .leading
271
         formStack.distribution = .fill
273
         formStack.distribution = .fill
272
         formStack.spacing = 24
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
         formStack.userInterfaceLayoutDirection = .leftToRight
276
         formStack.userInterfaceLayoutDirection = .leftToRight
275
         ProfileLayoutEnforcement.applyForcedLTR(to: formStack)
277
         ProfileLayoutEnforcement.applyForcedLTR(to: formStack)
276
         formStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
278
         formStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
@@ -298,9 +300,8 @@ final class MyProfilePageView: NSView {
298
             cardView.rightAnchor.constraint(equalTo: documentView.rightAnchor, constant: -Self.horizontalPageInset),
300
             cardView.rightAnchor.constraint(equalTo: documentView.rightAnchor, constant: -Self.horizontalPageInset),
299
             cardView.topAnchor.constraint(equalTo: documentView.topAnchor, constant: Self.horizontalPageInset),
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
             formStack.topAnchor.constraint(equalTo: cardView.topAnchor),
305
             formStack.topAnchor.constraint(equalTo: cardView.topAnchor),
305
             formStack.bottomAnchor.constraint(equalTo: cardView.bottomAnchor)
306
             formStack.bottomAnchor.constraint(equalTo: cardView.bottomAnchor)
306
         ])
307
         ])
@@ -371,7 +372,7 @@ final class MyProfilePageView: NSView {
371
     private func applyResponsiveRowsIfNeeded() {
372
     private func applyResponsiveRowsIfNeeded() {
372
         let w = cardView.bounds.width
373
         let w = cardView.bounds.width
373
         guard w > 1 else { return }
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
         let compact = formWidth < Self.compactFormWidth
376
         let compact = formWidth < Self.compactFormWidth
376
         guard compact != lastCompactLayout else { return }
377
         guard compact != lastCompactLayout else { return }
377
         lastCompactLayout = compact
378
         lastCompactLayout = compact