Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2025-12-24 13:57:36 -06:00
parent 71b27b671b
commit 2b0f36a12c
2 changed files with 28 additions and 19 deletions

View File

@ -128,15 +128,19 @@ struct GameTableView: View {
Design.debugLog(" Cached: \(Int(cachedScreenSize.width))×\(Int(cachedScreenSize.height)), initialized=\(hasInitializedScreenSize)") Design.debugLog(" Cached: \(Int(cachedScreenSize.width))×\(Int(cachedScreenSize.height)), initialized=\(hasInitializedScreenSize)")
} }
// Capture screen size ONCE on first valid measurement, then only on orientation change // Capture screen size ONCE on first valid measurement
// Use the DEFAULT initialized value (667 for iPhone) if first measurement is smaller
// This handles the case where safe area reduces the first measurement
if !hasInitializedScreenSize && size.width > 0 && size.height > 0 { if !hasInitializedScreenSize && size.width > 0 && size.height > 0 {
// First time: capture the initial size // Use the LARGER of default and first measurement
Design.debugLog("📐 🎯 INITIAL capture: \(Int(size.width))×\(Int(size.height))") let useHeight = max(size.height, cachedScreenSize.height)
cachedScreenSize = size let useWidth = max(size.width, cachedScreenSize.width)
let captureSize = CGSize(width: useWidth, height: useHeight)
Design.debugLog("📐 🎯 INITIAL capture: measured=\(Int(size.width))×\(Int(size.height)), using=\(Int(captureSize.width))×\(Int(captureSize.height))")
cachedScreenSize = captureSize
hasInitializedScreenSize = true hasInitializedScreenSize = true
} else if hasInitializedScreenSize { } else if hasInitializedScreenSize {
// After initialization: only update on TRUE orientation change // After initialization: ONLY update on TRUE orientation change
// (when portrait becomes landscape or vice versa)
let wasPortrait = cachedScreenSize.height > cachedScreenSize.width let wasPortrait = cachedScreenSize.height > cachedScreenSize.width
let isPortrait = size.height > size.width let isPortrait = size.height > size.width
@ -144,6 +148,7 @@ struct GameTableView: View {
Design.debugLog("📐 🔄 ORIENTATION changed: \(Int(cachedScreenSize.width))×\(Int(cachedScreenSize.height))\(Int(size.width))×\(Int(size.height))") Design.debugLog("📐 🔄 ORIENTATION changed: \(Int(cachedScreenSize.width))×\(Int(cachedScreenSize.height))\(Int(size.width))×\(Int(size.height))")
cachedScreenSize = size cachedScreenSize = size
} }
// Otherwise: IGNORE all geometry changes - keep cached size stable
} }
} }

View File

@ -42,7 +42,7 @@ struct DealerHandView: View {
} }
.frame(minHeight: badgeHeight) // Reserve consistent height .frame(minHeight: badgeHeight) // Reserve consistent height
.animation(.spring(duration: Design.Animation.springDuration), value: hand.cards.isEmpty) .animation(.spring(duration: Design.Animation.springDuration), value: hand.cards.isEmpty)
// Cards // Cards with result badge overlay (overlay prevents height change)
HStack(spacing: hand.cards.isEmpty ? Design.Spacing.small : cardSpacing) { HStack(spacing: hand.cards.isEmpty ? Design.Spacing.small : cardSpacing) {
if hand.cards.isEmpty { if hand.cards.isEmpty {
CardPlaceholderView(width: cardWidth) CardPlaceholderView(width: cardWidth)
@ -70,18 +70,22 @@ struct DealerHandView: View {
} }
} }
} }
.overlay(alignment: .bottom) {
// Result badge // Result badge - overlayed so it doesn't add height to the view
if let result = hand.cards.count >= 2 && showHoleCard ? handResultText : nil { if let result = hand.cards.count >= 2 && showHoleCard ? handResultText : nil {
Text(result) Text(result)
.font(.system(size: labelFontSize, weight: .black)) .font(.system(size: labelFontSize, weight: .black))
.foregroundStyle(handResultColor) .foregroundStyle(.white)
.padding(.horizontal, Design.Spacing.medium) .padding(.horizontal, Design.Spacing.medium)
.padding(.vertical, Design.Spacing.xSmall) .padding(.vertical, Design.Spacing.xSmall)
.background( .background(
Capsule() Capsule()
.fill(handResultColor.opacity(Design.Opacity.hint)) .fill(handResultColor)
.shadow(color: .black.opacity(Design.Opacity.medium), radius: Design.Shadow.radiusMedium)
) )
.offset(y: Design.Spacing.xLarge) // Position below cards
.transition(.scale.combined(with: .opacity))
}
} }
} }
.accessibilityElement(children: .ignore) .accessibilityElement(children: .ignore)