소스 검색

Merge pull request #1247 from deltachat/stickers_merge_unify_size

keep sticker size on rotation
cyBerta 4 년 전
부모
커밋
8f4ab8e9e0
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 3
      deltachat-ios/Chat/Views/Cells/ImageTextCell.swift

+ 1 - 3
deltachat-ios/Chat/Views/Cells/ImageTextCell.swift

@@ -108,7 +108,6 @@ class ImageTextCell: BaseMessageCell {
         var width = width
         var height = height
 
-        let orientation = UIApplication.shared.statusBarOrientation
         self.imageHeightConstraint?.isActive = false
         self.imageWidthConstraint?.isActive = false
 
@@ -119,8 +118,7 @@ class ImageTextCell: BaseMessageCell {
         }
 
         // check if sticker has the allowed maximal width
-        let factor: CGFloat = orientation.isLandscape ? 3 / 8 : 1 / 2
-        let maxWidth  = UIScreen.main.bounds.width * factor
+        let maxWidth  = min(UIScreen.main.bounds.height, UIScreen.main.bounds.width) / 2
         if width > maxWidth {
             height = (height / width) * maxWidth
             width = maxWidth