Clamp uncropped attachment aspect ratio

Closes #418
This commit is contained in:
Shadowfacts 2023-07-04 11:11:20 -07:00
parent 385f31728d
commit 50bfaf7236
1 changed files with 2 additions and 1 deletions

View File

@ -101,7 +101,8 @@ class AttachmentsContainerView: UIView {
accessibilityElements.append(attachmentView) accessibilityElements.append(attachmentView)
if Preferences.shared.showUncroppedMediaInline, if Preferences.shared.showUncroppedMediaInline,
let attachmentAspectRatio = attachmentView.attachmentAspectRatio { let attachmentAspectRatio = attachmentView.attachmentAspectRatio {
aspectRatio = attachmentAspectRatio // clamp to prevent excessively short/tall attachments
aspectRatio = max(min(attachmentAspectRatio, 2/1), 1/2)
} }
case 2: case 2:
let left = createAttachmentView(index: 0, hSize: .half, vSize: .full) let left = createAttachmentView(index: 0, hSize: .half, vSize: .full)