Files
OSGKeyboard/OSGKeyboardShared/Models/KeyboardChromeLayout.swift
T
Rocky 31f5937a7f feat(keyboard): improve typing, voice flow, and polish reliability
Reduce extension memory pressure and delivery races while adding richer candidates, tactile feedback, and safer two-level creative polishing.
2026-08-05 21:39:31 +08:00

29 lines
1.1 KiB
Swift

// KeyboardChromeLayout.swift
// OSGKeyboard · Shared
//
// Cross-surface dimensions that must stay identical in voice and typing modes.
import CoreGraphics
public enum KeyboardChromeLayout {
public static let totalHeight: CGFloat = 281
public static let actionKeyHeight: CGFloat = 50
public static let actionKeyCornerRadius: CGFloat = 10
/// Shared geometry for every three-key bottom row.
public static let actionKeySpacing: CGFloat = 8
public static let sideActionKeyFraction: CGFloat = 0.2
public static let centerActionKeyFraction: CGFloat = 0.6
public static let horizontalInset: CGFloat = 8
/// Keeps voice and typing controls equally reachable on iPad.
public static let contentMaxWidth: CGFloat = 700
/// Splits the width left after spacing into a 20 / 60 / 20 row.
public static func actionKeyWidths(availableWidth: CGFloat) -> (side: CGFloat, center: CGFloat) {
let keyWidth = max(0, availableWidth - actionKeySpacing * 2)
return (
side: keyWidth * sideActionKeyFraction,
center: keyWidth * centerActionKeyFraction
)
}
}