mirror of https://code.videolan.org/videolan/vlc
macosx: Add ability to disable dynamic item sizing in VLCLibraryCollectionViewDelegate
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
parent
a53ae4898c
commit
6279fcd121
|
@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@interface VLCLibraryCollectionViewDelegate : NSObject <NSCollectionViewDelegate, NSCollectionViewDelegateFlowLayout>
|
||||
|
||||
@property (readwrite, assign) BOOL dynamicItemSizing;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -28,6 +28,15 @@
|
|||
|
||||
@implementation VLCLibraryCollectionViewDelegate
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_dynamicItemSizing = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)collectionView:(NSCollectionView *)collectionView didSelectItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths
|
||||
{
|
||||
NSIndexPath *indexPath = indexPaths.anyObject;
|
||||
|
@ -58,6 +67,10 @@
|
|||
layout:(NSCollectionViewLayout *)collectionViewLayout
|
||||
sizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (!_dynamicItemSizing) {
|
||||
return CGSizeMake(214., 260.);
|
||||
}
|
||||
|
||||
VLCLibraryCollectionViewFlowLayout *collectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout*)collectionViewLayout;
|
||||
if (collectionViewLayout) {
|
||||
VLCLibraryCollectionViewFlowLayout *collectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout*)collectionViewLayout;
|
||||
|
|
Loading…
Reference in New Issue