Skip to content

Commit

Permalink
Fix size of media on iPad when multitasking.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Jun 24, 2022
1 parent 32220fc commit 782b1cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

#import "MXKSwiftHeader.h"

#import "LegacyAppDelegate.h"

@interface MXKAttachmentsViewController () <UINavigationControllerDelegate, UIViewControllerTransitioningDelegate>
{
/**
Expand Down Expand Up @@ -472,7 +474,8 @@ - (void)refreshCurrentVisibleItemIndex
// Check whether the collection is actually rendered
if (_attachmentsCollection.contentSize.width)
{
currentVisibleItemIndex = _attachmentsCollection.contentOffset.x / [[UIScreen mainScreen] bounds].size.width;
UIWindow *window = LegacyAppDelegate.theDelegate.window;
currentVisibleItemIndex = _attachmentsCollection.contentOffset.x / window.bounds.size.width;
}
else
{
Expand All @@ -485,8 +488,9 @@ - (void)refreshAttachmentCollectionContentOffset
if (currentVisibleItemIndex != NSNotFound && _attachmentsCollection)
{
// Set the content offset to display the current attachment
UIWindow *window = LegacyAppDelegate.theDelegate.window;
CGPoint contentOffset = _attachmentsCollection.contentOffset;
contentOffset.x = currentVisibleItemIndex * [[UIScreen mainScreen] bounds].size.width;
contentOffset.x = currentVisibleItemIndex * window.bounds.size.width; //[[UIScreen mainScreen] bounds].size.width;
_attachmentsCollection.contentOffset = contentOffset;
}
}
Expand Down Expand Up @@ -1118,7 +1122,7 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return [[UIScreen mainScreen] bounds].size;
return LegacyAppDelegate.theDelegate.window.bounds.size;
}

#pragma mark - Movie Player
Expand Down

0 comments on commit 782b1cc

Please sign in to comment.