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

This commit is contained in:
Matt Bruce 2025-12-22 17:55:40 -06:00
parent bcd6a75e84
commit e41eadff3c
4 changed files with 39 additions and 41 deletions

View File

@ -34,14 +34,13 @@ enum Design {
enum Size {
// MARK: - Hand Scaling
/// Hand scaling factor for cards and related elements.
/// 1.0 = original size, 1.5 = 50% larger, 2.0 = double size.
/// Adjust this value to change card sizes across the app.
static let handScale: CGFloat = 1.75
/// Hand scaling factor for small screens (iPhone SE, etc).
/// Applied on screens narrower than smallScreenThreshold.
static let handScaleSmall: CGFloat = 1.75
/// Scale multiplier for small screens (iPhone SE, etc).
/// Applied instead of handScale on screens narrower than smallScreenThreshold.
static let smallScreenScale: CGFloat = 1.2
/// Hand scaling factor for standard+ iPhones.
/// Applied on screens wider than smallScreenThreshold.
static let handScaleLarge: CGFloat = 2.0
/// Screen width threshold for small screen detection (iPhone SE is 375pt)
static let smallScreenThreshold: CGFloat = 390
@ -50,37 +49,45 @@ enum Design {
/// Applied on top of handScale when on regular size class.
static let largeScreenMultiplier: CGFloat = 1.2
/// Returns the appropriate hand scale based on screen width.
/// - Parameter screenWidth: The current screen width in points
/// - Returns: handScaleSmall for iPhone SE, handScaleLarge for larger phones
static func handScale(for screenWidth: CGFloat) -> CGFloat {
screenWidth <= smallScreenThreshold ? handScaleSmall : handScaleLarge
}
// Cards - base values from CasinoDesign
static let cardWidthSmall: CGFloat = CasinoDesign.Size.cardWidthSmall
static let cardWidthMedium: CGFloat = CasinoDesign.Size.cardWidthMedium
static let cardWidthLarge: CGFloat = CasinoDesign.Size.cardWidthLarge
static let cardAspectRatio: CGFloat = CasinoDesign.Size.cardAspectRatio
/// Base card width before scaling (for reference)
private static let cardWidthTableBase: CGFloat = 45
/// Base card width before scaling
static let cardWidthTableBase: CGFloat = 45
/// Base card overlap before scaling.
/// More negative = more overlap (less card visible).
/// -15 is default, -20 shows less card, -25 shows even less.
private static let cardOverlapBase: CGFloat = -25
/// Card overlap scaled with hand size (standard iPhone)
static let cardOverlap: CGFloat = cardOverlapBase * handScale
/// Returns card width for the given screen width
static func cardWidthTable(for screenWidth: CGFloat) -> CGFloat {
cardWidthTableBase * handScale(for: screenWidth)
}
/// Card overlap for small screens
static let cardOverlapSmall: CGFloat = cardOverlapBase * smallScreenScale
/// Returns card width for iPad (with large screen multiplier)
static func cardWidthTableLarge(for screenWidth: CGFloat) -> CGFloat {
cardWidthTableBase * handScale(for: screenWidth) * largeScreenMultiplier
}
// Baccarat table cards - scaled for better visibility (standard iPhone)
static let cardWidthTable: CGFloat = cardWidthTableBase * handScale
/// Returns card overlap for the given screen width
static func cardOverlap(for screenWidth: CGFloat) -> CGFloat {
cardOverlapBase * handScale(for: screenWidth)
}
/// Card width for small screens (iPhone SE, etc)
static let cardWidthTableSmall: CGFloat = cardWidthTableBase * smallScreenScale
/// Card width for large screens (iPad) - applies additional multiplier
static let cardWidthTableLarge: CGFloat = cardWidthTableBase * handScale * largeScreenMultiplier
/// Card overlap for large screens
static let cardOverlapLarge: CGFloat = cardOverlapBase * handScale * largeScreenMultiplier
/// Returns card overlap for iPad (with large screen multiplier)
static func cardOverlapLarge(for screenWidth: CGFloat) -> CGFloat {
cardOverlapBase * handScale(for: screenWidth) * largeScreenMultiplier
}
// Chips - use CasinoDesign values
static let chipSmall: CGFloat = CasinoDesign.Size.chipSmall

View File

@ -39,13 +39,13 @@ struct CardsDisplayArea: View {
/// Label font size - only scales on iPad to avoid clipping on small iPhones
private var labelFontSize: CGFloat {
let baseSize: CGFloat = 14
return isLargeScreen ? baseSize * Design.Size.handScale * Design.Size.largeScreenMultiplier : baseSize
return isLargeScreen ? baseSize * Design.Size.handScale(for: screenWidth) * Design.Size.largeScreenMultiplier : baseSize
}
/// Minimum height for label row - only scales on iPad
private var labelRowMinHeight: CGFloat {
let baseHeight: CGFloat = 30
return isLargeScreen ? baseHeight * Design.Size.handScale * Design.Size.largeScreenMultiplier : baseHeight
return isLargeScreen ? baseHeight * Design.Size.handScale(for: screenWidth) * Design.Size.largeScreenMultiplier : baseHeight
}
/// Spacing between PLAYER and BANKER hands - reduced on smaller screens

View File

@ -27,25 +27,18 @@ struct CompactHandView: View {
horizontalSizeClass == .regular
}
/// Whether we're on a small screen (iPhone SE, etc)
private var isSmallScreen: Bool {
!isLargeScreen && screenWidth < Design.Size.smallScreenThreshold
}
/// WIN badge font size - only scales on iPad
private var winBadgeFontSize: CGFloat {
let baseSize: CGFloat = 10
return isLargeScreen ? baseSize * Design.Size.handScale * Design.Size.largeScreenMultiplier : baseSize
return isLargeScreen ? baseSize * Design.Size.handScale(for: screenWidth) * Design.Size.largeScreenMultiplier : baseSize
}
/// Card width - responsive based on screen size
private var cardWidth: CGFloat {
if isLargeScreen {
return Design.Size.cardWidthTableLarge
} else if isSmallScreen {
return Design.Size.cardWidthTableSmall
return Design.Size.cardWidthTableLarge(for: screenWidth)
} else {
return Design.Size.cardWidthTable
return Design.Size.cardWidthTable(for: screenWidth)
}
}
@ -57,11 +50,9 @@ struct CompactHandView: View {
/// Card overlap - scaled with card size
private var cardOverlap: CGFloat {
if isLargeScreen {
return Design.Size.cardOverlapLarge
} else if isSmallScreen {
return Design.Size.cardOverlapSmall
return Design.Size.cardOverlapLarge(for: screenWidth)
} else {
return Design.Size.cardOverlap
return Design.Size.cardOverlap(for: screenWidth)
}
}

View File

@ -26,7 +26,7 @@ struct HandValueBadge: View {
/// Scale factor for badge sizing - only applies on iPad to avoid clipping on iPhone
private var scale: CGFloat {
isLargeScreen ? Design.Size.handScale * Design.Size.largeScreenMultiplier : 1.0
isLargeScreen ? Design.Size.handScaleLarge * Design.Size.largeScreenMultiplier : 1.0
}
@ScaledMetric(relativeTo: .headline) private var baseValueFontSize: CGFloat = 15