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 { enum Size {
// MARK: - Hand Scaling // MARK: - Hand Scaling
/// Hand scaling factor for cards and related elements. /// Hand scaling factor for small screens (iPhone SE, etc).
/// 1.0 = original size, 1.5 = 50% larger, 2.0 = double size. /// Applied on screens narrower than smallScreenThreshold.
/// Adjust this value to change card sizes across the app. static let handScaleSmall: CGFloat = 1.75
static let handScale: CGFloat = 1.75
/// Scale multiplier for small screens (iPhone SE, etc). /// Hand scaling factor for standard+ iPhones.
/// Applied instead of handScale on screens narrower than smallScreenThreshold. /// Applied on screens wider than smallScreenThreshold.
static let smallScreenScale: CGFloat = 1.2 static let handScaleLarge: CGFloat = 2.0
/// Screen width threshold for small screen detection (iPhone SE is 375pt) /// Screen width threshold for small screen detection (iPhone SE is 375pt)
static let smallScreenThreshold: CGFloat = 390 static let smallScreenThreshold: CGFloat = 390
@ -50,37 +49,45 @@ enum Design {
/// Applied on top of handScale when on regular size class. /// Applied on top of handScale when on regular size class.
static let largeScreenMultiplier: CGFloat = 1.2 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 // Cards - base values from CasinoDesign
static let cardWidthSmall: CGFloat = CasinoDesign.Size.cardWidthSmall static let cardWidthSmall: CGFloat = CasinoDesign.Size.cardWidthSmall
static let cardWidthMedium: CGFloat = CasinoDesign.Size.cardWidthMedium static let cardWidthMedium: CGFloat = CasinoDesign.Size.cardWidthMedium
static let cardWidthLarge: CGFloat = CasinoDesign.Size.cardWidthLarge static let cardWidthLarge: CGFloat = CasinoDesign.Size.cardWidthLarge
static let cardAspectRatio: CGFloat = CasinoDesign.Size.cardAspectRatio static let cardAspectRatio: CGFloat = CasinoDesign.Size.cardAspectRatio
/// Base card width before scaling (for reference) /// Base card width before scaling
private static let cardWidthTableBase: CGFloat = 45 static let cardWidthTableBase: CGFloat = 45
/// Base card overlap before scaling. /// Base card overlap before scaling.
/// More negative = more overlap (less card visible). /// More negative = more overlap (less card visible).
/// -15 is default, -20 shows less card, -25 shows even less.
private static let cardOverlapBase: CGFloat = -25 private static let cardOverlapBase: CGFloat = -25
/// Card overlap scaled with hand size (standard iPhone) /// Returns card width for the given screen width
static let cardOverlap: CGFloat = cardOverlapBase * handScale static func cardWidthTable(for screenWidth: CGFloat) -> CGFloat {
cardWidthTableBase * handScale(for: screenWidth)
}
/// Card overlap for small screens /// Returns card width for iPad (with large screen multiplier)
static let cardOverlapSmall: CGFloat = cardOverlapBase * smallScreenScale static func cardWidthTableLarge(for screenWidth: CGFloat) -> CGFloat {
cardWidthTableBase * handScale(for: screenWidth) * largeScreenMultiplier
}
// Baccarat table cards - scaled for better visibility (standard iPhone) /// Returns card overlap for the given screen width
static let cardWidthTable: CGFloat = cardWidthTableBase * handScale static func cardOverlap(for screenWidth: CGFloat) -> CGFloat {
cardOverlapBase * handScale(for: screenWidth)
}
/// Card width for small screens (iPhone SE, etc) /// Returns card overlap for iPad (with large screen multiplier)
static let cardWidthTableSmall: CGFloat = cardWidthTableBase * smallScreenScale static func cardOverlapLarge(for screenWidth: CGFloat) -> CGFloat {
cardOverlapBase * handScale(for: screenWidth) * largeScreenMultiplier
/// 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
// Chips - use CasinoDesign values // Chips - use CasinoDesign values
static let chipSmall: CGFloat = CasinoDesign.Size.chipSmall 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 /// Label font size - only scales on iPad to avoid clipping on small iPhones
private var labelFontSize: CGFloat { private var labelFontSize: CGFloat {
let baseSize: CGFloat = 14 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 /// Minimum height for label row - only scales on iPad
private var labelRowMinHeight: CGFloat { private var labelRowMinHeight: CGFloat {
let baseHeight: CGFloat = 30 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 /// Spacing between PLAYER and BANKER hands - reduced on smaller screens

View File

@ -27,25 +27,18 @@ struct CompactHandView: View {
horizontalSizeClass == .regular 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 /// WIN badge font size - only scales on iPad
private var winBadgeFontSize: CGFloat { private var winBadgeFontSize: CGFloat {
let baseSize: CGFloat = 10 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 /// Card width - responsive based on screen size
private var cardWidth: CGFloat { private var cardWidth: CGFloat {
if isLargeScreen { if isLargeScreen {
return Design.Size.cardWidthTableLarge return Design.Size.cardWidthTableLarge(for: screenWidth)
} else if isSmallScreen {
return Design.Size.cardWidthTableSmall
} else { } else {
return Design.Size.cardWidthTable return Design.Size.cardWidthTable(for: screenWidth)
} }
} }
@ -57,11 +50,9 @@ struct CompactHandView: View {
/// Card overlap - scaled with card size /// Card overlap - scaled with card size
private var cardOverlap: CGFloat { private var cardOverlap: CGFloat {
if isLargeScreen { if isLargeScreen {
return Design.Size.cardOverlapLarge return Design.Size.cardOverlapLarge(for: screenWidth)
} else if isSmallScreen {
return Design.Size.cardOverlapSmall
} else { } 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 /// Scale factor for badge sizing - only applies on iPad to avoid clipping on iPhone
private var scale: CGFloat { 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 @ScaledMetric(relativeTo: .headline) private var baseValueFontSize: CGFloat = 15