diff --git a/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift b/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift index 428ffed..e8197f0 100644 --- a/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift +++ b/Baccarat/Baccarat/Views/Table/CardsDisplayArea.swift @@ -280,6 +280,7 @@ struct CardsDisplayArea: View { revealProgress: revealProgress, isPlayerHand: true, isBottom: playerOnBottom, + isDealing: isDealing, onReveal: onReveal, onUpdateProgress: onUpdateProgress ) @@ -330,6 +331,7 @@ struct CardsDisplayArea: View { revealProgress: revealProgress, isPlayerHand: false, isBottom: !playerOnBottom, + isDealing: isDealing, onReveal: onReveal, onUpdateProgress: onUpdateProgress ) diff --git a/Baccarat/Baccarat/Views/Table/CompactHandView.swift b/Baccarat/Baccarat/Views/Table/CompactHandView.swift index f4b632f..485ee17 100644 --- a/Baccarat/Baccarat/Views/Table/CompactHandView.swift +++ b/Baccarat/Baccarat/Views/Table/CompactHandView.swift @@ -25,6 +25,8 @@ struct CompactHandView: View { let isPlayerHand: Bool /// Whether this hand is currently displayed at the bottom of the screen (Home hand) let isBottom: Bool + /// Whether the game is in dealing phase (vertical layout) vs betting phase (horizontal layout) + let isDealing: Bool let onReveal: () -> Void let onUpdateProgress: (Double) -> Void @@ -55,18 +57,28 @@ struct CompactHandView: View { isLargeScreen ? 14 : 10 } - /// Card width calculated from container width - /// Formula accounts for spacing between 3 cards + /// Card width for dealt cards - sized to fit 3 cards with spacing private var cardWidth: CGFloat { // containerWidth = 3 * cardWidth + 2 * spacing // cardWidth = (containerWidth - 2 * spacing) / 3 - let spacing = cardSpacing - return max(50, (containerWidth - 2 * spacing) / CGFloat(maxCards)) + return max(50, (containerWidth - 2 * cardSpacing) / CGFloat(maxCards)) + } + + /// Card width for placeholders in horizontal betting view - uses original larger sizing + private var bettingPlaceholderWidth: CGFloat { + // Original formula: containerWidth / 2.1 (from overlap ratio of -0.45) + containerWidth / 2.1 + } + + /// Card width to use for placeholders - larger in betting view, regular in dealing view + private var placeholderWidth: CGFloat { + isDealing ? cardWidth : bettingPlaceholderWidth } /// Card height based on aspect ratio private var cardHeight: CGFloat { - cardWidth * CasinoDesign.Size.cardAspectRatio + let width = cards.isEmpty ? placeholderWidth : cardWidth + return width * CasinoDesign.Size.cardAspectRatio } /// The effective spacing for the card stack @@ -127,7 +139,7 @@ struct CompactHandView: View { if cards.isEmpty { // Placeholders - no overlap, just side by side ForEach(0..<2, id: \.self) { _ in - CardPlaceholderView(width: cardWidth) + CardPlaceholderView(width: placeholderWidth) } } else { ForEach(cards.indices, id: \.self) { index in @@ -204,7 +216,7 @@ struct CompactHandView: View { // MARK: - Previews -#Preview("Empty Hand") { +#Preview("Empty Hand - Betting") { ZStack { TableBackgroundView() CompactHandView( @@ -220,13 +232,14 @@ struct CompactHandView: View { revealProgress: 0, isPlayerHand: true, isBottom: true, + isDealing: false, onReveal: {}, onUpdateProgress: { _ in } ) } } -#Preview("Two Cards") { +#Preview("Two Cards - Dealing") { ZStack { TableBackgroundView() CompactHandView( @@ -245,6 +258,7 @@ struct CompactHandView: View { revealProgress: 0, isPlayerHand: true, isBottom: true, + isDealing: true, onReveal: {}, onUpdateProgress: { _ in } ) @@ -271,6 +285,7 @@ struct CompactHandView: View { revealProgress: 0, isPlayerHand: true, isBottom: true, + isDealing: true, onReveal: {}, onUpdateProgress: { _ in } ) @@ -296,6 +311,7 @@ struct CompactHandView: View { revealProgress: 0, isPlayerHand: true, isBottom: true, + isDealing: true, onReveal: {}, onUpdateProgress: { _ in } )