From bc5b9928f81f6a077da4c3151e03e79ec9647a22 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Mon, 6 Jul 2026 04:22:41 -0700 Subject: [PATCH] Truncation Logic Refinement Nucleic-Session: FE1E2C94-7945-4827-AF56-74525A9BD434 Co-authored-by: Nucleic --- .../NucleicRemote/Views/AskUserQuestionCardView.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift b/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift index fdcf16f..4a81684 100644 --- a/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift +++ b/NucleicRemote/NucleicRemote/Views/AskUserQuestionCardView.swift @@ -95,6 +95,17 @@ struct AskUserQuestionCardView: View { } .padding() .glassSurface(cornerRadius: 20) + // A hard ceiling on the whole card so it can never exceed the screen; `nil` (before the + // height is measured) leaves it unconstrained. + .frame(maxHeight: availableHeight > 0 ? availableHeight - 12 : nil, alignment: .bottom) + } + + /// The height the scrolling question region may take before it starts scrolling — the screen + /// minus a reserve for the header and the button row, so those always have room. Falls back to + /// a roomy default before the height is measured. + private var middleMaxHeight: CGFloat { + let base = availableHeight > 0 ? availableHeight - 12 : 640 + return max(160, base - 170) } // MARK: - Wizard state