From 50bfaf7236faef49ab07e4fa6aefe02794a36d7f Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 4 Jul 2023 11:11:20 -0700 Subject: [PATCH] Clamp uncropped attachment aspect ratio Closes #418 --- Tusker/Views/Attachments/AttachmentsContainerView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/Attachments/AttachmentsContainerView.swift b/Tusker/Views/Attachments/AttachmentsContainerView.swift index 662e38f6..bd449c9b 100644 --- a/Tusker/Views/Attachments/AttachmentsContainerView.swift +++ b/Tusker/Views/Attachments/AttachmentsContainerView.swift @@ -101,7 +101,8 @@ class AttachmentsContainerView: UIView { accessibilityElements.append(attachmentView) if Preferences.shared.showUncroppedMediaInline, let attachmentAspectRatio = attachmentView.attachmentAspectRatio { - aspectRatio = attachmentAspectRatio + // clamp to prevent excessively short/tall attachments + aspectRatio = max(min(attachmentAspectRatio, 2/1), 1/2) } case 2: let left = createAttachmentView(index: 0, hSize: .half, vSize: .full)