diff --git a/SelfieRingLight/Features/Camera/RingLightCameraScreen.swift b/SelfieRingLight/Features/Camera/RingLightCameraScreen.swift index 87fc330..01dc11e 100644 --- a/SelfieRingLight/Features/Camera/RingLightCameraScreen.swift +++ b/SelfieRingLight/Features/Camera/RingLightCameraScreen.swift @@ -16,26 +16,12 @@ struct RingLightCameraScreen: MCameraScreen { // MARK: - Layout Constants - /// Camera aspect ratio (4:3 for photos) - private let cameraAspectRatio: CGFloat = 4.0 / 3.0 - /// Capture button inner padding private let captureButtonInnerPadding: CGFloat = 8 - /// Control bar height for layout calculations - private let controlBarHeight: CGFloat = 100 - var body: some View { GeometryReader { geometry in let safeArea = geometry.safeAreaInsets - let availableWidth = geometry.size.width - let availableHeight = geometry.size.height - - // Calculate camera size to fit within available space with ring padding - let cameraSize = calculateCameraSize( - availableWidth: availableWidth - (effectiveRingSize * 2), - availableHeight: availableHeight - (effectiveRingSize * 2) - controlBarHeight - safeArea.top - ) ZStack { // Ring light background - fills entire screen @@ -47,50 +33,33 @@ struct RingLightCameraScreen: MCameraScreen { // Top control bar topControlBar .padding(.top, safeArea.top + Design.Spacing.small) + .padding(.horizontal, Design.Spacing.large) - Spacer() - - // Camera preview - centered with fixed aspect ratio + // Camera preview - uses native camera aspect ratio + // The ring light is the padding around it createCameraOutputView() - .frame(width: cameraSize.width, height: cameraSize.height) .clipShape(RoundedRectangle(cornerRadius: Design.CornerRadius.large)) + .padding(.horizontal, effectiveRingSize) + .padding(.vertical, Design.Spacing.medium) .overlay { // Grid overlay on top of camera if settings.isGridVisible { GridOverlay(isVisible: true) - .clipShape(RoundedRectangle(cornerRadius: Design.CornerRadius.large)) + .padding(.horizontal, effectiveRingSize) + .padding(.vertical, Design.Spacing.medium) } } - Spacer() - // Bottom control bar bottomControlBar - .padding(.bottom, safeArea.bottom + Design.Spacing.medium) + .padding(.bottom, safeArea.bottom + Design.Spacing.small) + .padding(.horizontal, Design.Spacing.xLarge) } } .ignoresSafeArea() } } - // MARK: - Camera Size Calculation - - /// Calculates camera size maintaining aspect ratio within available space - private func calculateCameraSize(availableWidth: CGFloat, availableHeight: CGFloat) -> CGSize { - let targetWidth = availableWidth - let targetHeight = targetWidth * cameraAspectRatio - - if targetHeight <= availableHeight { - // Width-constrained - return CGSize(width: targetWidth, height: targetHeight) - } else { - // Height-constrained - let height = availableHeight - let width = height / cameraAspectRatio - return CGSize(width: width, height: height) - } - } - // MARK: - Ring Size private var effectiveRingSize: CGFloat { @@ -129,7 +98,6 @@ struct RingLightCameraScreen: MCameraScreen { onSettingsTapped() } } - .padding(.horizontal, Design.Spacing.large) } // MARK: - Bottom Control Bar @@ -159,7 +127,6 @@ struct RingLightCameraScreen: MCameraScreen { Color.clear .frame(width: 44, height: 44) } - .padding(.horizontal, Design.Spacing.xLarge) } // MARK: - Control Button Helper