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