Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
0823e46d72
commit
c2056e719d
@ -775,6 +775,7 @@ private extension CardEditorView {
|
||||
card.theme = selectedTheme
|
||||
card.layoutStyle = selectedLayout
|
||||
card.photoData = photoData
|
||||
card.coverPhotoData = coverPhotoData
|
||||
card.logoData = logoData
|
||||
|
||||
// Save contact fields to the model's array
|
||||
|
||||
@ -48,11 +48,12 @@ struct PhotoCropperSheet: View {
|
||||
@State private var lastOffset: CGSize = .zero
|
||||
@State private var containerSize: CGSize = .zero
|
||||
|
||||
// Base crop dimension - will be adjusted by aspect ratio
|
||||
private let baseCropWidth: CGFloat = 300
|
||||
// Horizontal padding for the crop area
|
||||
private let horizontalPadding: CGFloat = 20
|
||||
|
||||
private var cropWidth: CGFloat {
|
||||
min(baseCropWidth, containerSize.width - 40) // Leave some padding
|
||||
// Use almost full width for better cropping experience
|
||||
max(100, containerSize.width - (horizontalPadding * 2))
|
||||
}
|
||||
|
||||
private var cropHeight: CGFloat {
|
||||
@ -60,7 +61,11 @@ struct PhotoCropperSheet: View {
|
||||
}
|
||||
|
||||
private var cropSize: CGSize {
|
||||
CGSize(width: cropWidth, height: cropHeight)
|
||||
// Guard against zero/invalid sizes
|
||||
guard containerSize.width > 0, containerSize.height > 0 else {
|
||||
return CGSize(width: 280, height: 280 / aspectRatio.ratio)
|
||||
}
|
||||
return CGSize(width: cropWidth, height: cropHeight)
|
||||
}
|
||||
|
||||
private var uiImage: UIImage? {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user