Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
1fe7bbb274
commit
3aa1ed77ae
@ -520,6 +520,12 @@ final class GameState: CasinoGameState {
|
||||
|
||||
// Animation timing
|
||||
let animationDuration = Design.Animation.springDuration * settings.dealingSpeed
|
||||
|
||||
// Brief delay to let SwiftUI render the player hands container before cards fly in
|
||||
// This ensures the container with placeholders is visible before the first card animates
|
||||
if settings.showAnimations {
|
||||
try? await Task.sleep(for: .milliseconds(200))
|
||||
}
|
||||
// Small delay for card to appear on screen before updating badge (~15% of animation)
|
||||
let cardAppearDelay = settings.showAnimations ? animationDuration * 0.15 : 0
|
||||
// Remaining delay after badge update to complete the animation
|
||||
|
||||
@ -116,8 +116,9 @@ struct BlackjackTableView: View {
|
||||
Spacer(minLength: Design.Spacing.small)
|
||||
.debugBorder(showDebugBorders, color: .yellow, label: "BottomSpacer")
|
||||
|
||||
// Player hands area - only show when there are cards dealt
|
||||
if state.playerHands.first?.cards.isEmpty == false {
|
||||
// Player hands area - show when not betting (includes dealing phase)
|
||||
// This ensures the container with placeholders is visible BEFORE cards fly in
|
||||
if state.currentPhase != .betting {
|
||||
ZStack {
|
||||
PlayerHandsContainer(
|
||||
hands: state.playerHands,
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// A circular badge showing a numeric value.
|
||||
/// A capsule badge showing a numeric value.
|
||||
public struct ValueBadge: View {
|
||||
/// The value to display.
|
||||
public let value: Int
|
||||
@ -21,7 +21,8 @@ public struct ValueBadge: View {
|
||||
// MARK: - Scaled Font Sizes (Dynamic Type)
|
||||
|
||||
@ScaledMetric(relativeTo: .headline) private var valueFontSize: CGFloat = 15
|
||||
@ScaledMetric(relativeTo: .headline) private var badgeSize: CGFloat = CasinoDesign.Size.valueBadge
|
||||
@ScaledMetric(relativeTo: .headline) private var badgeHeight: CGFloat = CasinoDesign.Size.valueBadge
|
||||
@ScaledMetric(relativeTo: .headline) private var badgePadding: CGFloat = 8
|
||||
|
||||
/// Creates a value badge.
|
||||
/// - Parameters:
|
||||
@ -34,17 +35,20 @@ public struct ValueBadge: View {
|
||||
self.size = size
|
||||
}
|
||||
|
||||
private var displaySize: CGFloat {
|
||||
size ?? badgeSize
|
||||
private var displayHeight: CGFloat {
|
||||
size ?? badgeHeight
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
Text("\(value)")
|
||||
.font(.system(size: valueFontSize, weight: .black, design: .rounded))
|
||||
.foregroundStyle(.white)
|
||||
.frame(width: displaySize, height: displaySize)
|
||||
.lineLimit(1)
|
||||
.fixedSize(horizontal: true, vertical: false)
|
||||
.padding(.horizontal, badgePadding)
|
||||
.frame(minWidth: displayHeight, minHeight: displayHeight)
|
||||
.background(
|
||||
Circle()
|
||||
Capsule()
|
||||
.fill(color)
|
||||
)
|
||||
.accessibilityLabel("\(value)")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user