Signed-off-by: Matt Bruce <matt.bruce1@toyota.com>
This commit is contained in:
parent
8402432363
commit
09770ec625
@ -149,7 +149,13 @@ public enum CasinoDesign {
|
||||
|
||||
/// Common button dimensions.
|
||||
public static let actionButtonHeight: CGFloat = 50
|
||||
public static let actionButtonMinWidth: CGFloat = 80
|
||||
public static var actionButtonMinWidth: CGFloat {
|
||||
if let width = UIScreen.current?.bounds.width {
|
||||
return width < 400 ? 35.0 : 50.0
|
||||
} else {
|
||||
return 35.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Betting zone height.
|
||||
public static let bettingZoneHeight: CGFloat = 70
|
||||
@ -289,3 +295,24 @@ public extension Color {
|
||||
}
|
||||
}
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIScreen {
|
||||
/// Returns the current active screen (the one displaying the key window).
|
||||
/// This is the recommended replacement for the deprecated `UIScreen.main`.
|
||||
static var current: UIScreen? {
|
||||
// Find the active foreground scene
|
||||
UIApplication.shared.connectedScenes
|
||||
.compactMap { $0 as? UIWindowScene }
|
||||
.filter { $0.activationState == .foregroundActive }
|
||||
.first?
|
||||
.screen
|
||||
|
||||
// Alternative (more robust for key window):
|
||||
// UIApplication.shared.connectedScenes
|
||||
// .compactMap { $0 as? UIWindowScene }
|
||||
// .flatMap { $0.windows }
|
||||
// .first { $0.isKeyWindow }?
|
||||
// .screen
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public struct ActionButton: View {
|
||||
private let iconSize: CGFloat = 20
|
||||
|
||||
/// Minimum button width to prevent tiny buttons for short words like "Hit"
|
||||
private let minButtonWidth: CGFloat = 35
|
||||
private let minButtonWidth: CGFloat = CasinoDesign.Size.actionButtonMinWidth
|
||||
|
||||
/// Creates an action button.
|
||||
/// - Parameters:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user