Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
71b27b671b
commit
2b0f36a12c
@ -128,15 +128,19 @@ struct GameTableView: View {
|
||||
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 {
|
||||
// First time: capture the initial size
|
||||
Design.debugLog("📐 🎯 INITIAL capture: \(Int(size.width))×\(Int(size.height))")
|
||||
cachedScreenSize = size
|
||||
// Use the LARGER of default and first measurement
|
||||
let useHeight = max(size.height, cachedScreenSize.height)
|
||||
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
|
||||
} else if hasInitializedScreenSize {
|
||||
// After initialization: only update on TRUE orientation change
|
||||
// (when portrait becomes landscape or vice versa)
|
||||
// After initialization: ONLY update on TRUE orientation change
|
||||
let wasPortrait = cachedScreenSize.height > cachedScreenSize.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))")
|
||||
cachedScreenSize = size
|
||||
}
|
||||
// Otherwise: IGNORE all geometry changes - keep cached size stable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ struct DealerHandView: View {
|
||||
}
|
||||
.frame(minHeight: badgeHeight) // Reserve consistent height
|
||||
.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) {
|
||||
if hand.cards.isEmpty {
|
||||
CardPlaceholderView(width: cardWidth)
|
||||
@ -70,18 +70,22 @@ struct DealerHandView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Result badge
|
||||
.overlay(alignment: .bottom) {
|
||||
// Result badge - overlayed so it doesn't add height to the view
|
||||
if let result = hand.cards.count >= 2 && showHoleCard ? handResultText : nil {
|
||||
Text(result)
|
||||
.font(.system(size: labelFontSize, weight: .black))
|
||||
.foregroundStyle(handResultColor)
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, Design.Spacing.medium)
|
||||
.padding(.vertical, Design.Spacing.xSmall)
|
||||
.background(
|
||||
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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user