зеркало из https://github.com/nextcloud/talk-ios.git
Merge pull request #1073 from nextcloud/fix-layout-calculation-in-portrait-mode
Calculate the minimum width based on the target aspect ratio
This commit is contained in:
Коммит
49dbc7aa91
|
@ -65,24 +65,26 @@ class CallFlowLayout: UICollectionViewFlowLayout {
|
|||
guard let collectionView = collectionView else { return 1 }
|
||||
|
||||
let contentSize = collectionView.bounds.size
|
||||
let cellMinWidth = kCallParticipantCellMinHeight * targetAspectRatio + minimumInteritemSpacing
|
||||
|
||||
if (contentSize.width / kCallParticipantCellMinWidth).rounded(.down) < 1 {
|
||||
if (contentSize.width / cellMinWidth).rounded(.down) < 1 {
|
||||
return 1
|
||||
}
|
||||
|
||||
return Int((contentSize.width / kCallParticipantCellMinWidth).rounded(.down))
|
||||
return Int((contentSize.width / cellMinWidth).rounded(.down))
|
||||
}
|
||||
|
||||
func rowsMax() -> Int {
|
||||
guard let collectionView = collectionView else { return 1 }
|
||||
|
||||
let contentSize = collectionView.bounds.size
|
||||
let cellMinHeight = kCallParticipantCellMinHeight + minimumLineSpacing
|
||||
|
||||
if (contentSize.height / kCallParticipantCellMinHeight).rounded(.down) < 1 {
|
||||
if (contentSize.height / cellMinHeight).rounded(.down) < 1 {
|
||||
return 1
|
||||
}
|
||||
|
||||
return Int((contentSize.height / kCallParticipantCellMinHeight).rounded(.down))
|
||||
return Int((contentSize.height / cellMinHeight).rounded(.down))
|
||||
}
|
||||
|
||||
// Based on the makeGrid method of web:
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
extern NSString *const kCallParticipantCellIdentifier;
|
||||
extern NSString *const kCallParticipantCellNibName;
|
||||
extern CGFloat const kCallParticipantCellMinHeight;
|
||||
extern CGFloat const kCallParticipantCellMinWidth;
|
||||
|
||||
@class CallParticipantViewCell;
|
||||
@protocol CallParticipantViewCellDelegate <NSObject>
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
NSString *const kCallParticipantCellIdentifier = @"CallParticipantCellIdentifier";
|
||||
NSString *const kCallParticipantCellNibName = @"CallParticipantViewCell";
|
||||
CGFloat const kCallParticipantCellMinHeight = 128;
|
||||
CGFloat const kCallParticipantCellMinWidth = 192; // Aspect ratio of 1.5
|
||||
|
||||
@interface CallParticipantViewCell()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче