mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
#1666 (toggling fullscreen loses story position)
- The story scroll position is now maintained (as best as possible) when toggling fullscreen.
This commit is contained in:
parent
b8453fe985
commit
d812bfdfdd
4 changed files with 17 additions and 7 deletions
|
@ -4246,6 +4246,11 @@
|
|||
|
||||
- (void)markScrollPosition:(NSInteger)position inStory:(NSDictionary *)story {
|
||||
if (position < 0) return;
|
||||
|
||||
if (position == 0) {
|
||||
position = 1;
|
||||
}
|
||||
|
||||
__block NSNumber *positionNum = @(position);
|
||||
__block NSDictionary *storyDict = story;
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ UIActionSheetDelegate, WKNavigationDelegate> {
|
|||
- (void)tryScrollingDown:(BOOL)down;
|
||||
- (void)scrollPageDown:(id)sender;
|
||||
- (void)scrollPageUp:(id)sender;
|
||||
- (void)realignScroll;
|
||||
- (void)changeWebViewWidth;
|
||||
- (void)showUserProfile:(NSString *)userId xCoordinate:(int)x yCoordinate:(int)y width:(int)width height:(int)height;
|
||||
- (void)checkTryFeedStory;
|
||||
|
|
|
@ -1495,6 +1495,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)realignScroll {
|
||||
hasScrolled = NO;
|
||||
[self scrollToLastPosition:YES];
|
||||
}
|
||||
|
||||
- (void)scrollToLastPosition:(BOOL)animated {
|
||||
if (hasScrolled) return;
|
||||
hasScrolled = YES;
|
||||
|
|
|
@ -638,18 +638,15 @@
|
|||
}
|
||||
|
||||
- (void)reorientPages {
|
||||
[self applyNewIndex:currentPage.pageIndex-1 pageController:previousPage supressRedraw:YES];
|
||||
[self applyNewIndex:currentPage.pageIndex+1 pageController:nextPage supressRedraw:YES];
|
||||
[self applyNewIndex:currentPage.pageIndex pageController:currentPage supressRedraw:YES];
|
||||
|
||||
NSInteger currentIndex = currentPage.pageIndex;
|
||||
[self resizeScrollView]; // Will change currentIndex, so preserve
|
||||
|
||||
[self applyNewIndex:currentPage.pageIndex-1 pageController:previousPage supressRedraw:YES];
|
||||
[self applyNewIndex:currentPage.pageIndex+1 pageController:nextPage supressRedraw:YES];
|
||||
[self applyNewIndex:currentPage.pageIndex pageController:currentPage supressRedraw:YES];
|
||||
|
||||
// Scroll back to preserved index
|
||||
CGRect frame = self.scrollView.bounds;
|
||||
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
||||
frame = self.scrollView.bounds;
|
||||
}
|
||||
|
||||
if (self.isHorizontal) {
|
||||
frame.origin.x = frame.size.width * currentIndex;
|
||||
|
@ -663,6 +660,8 @@
|
|||
// NSLog(@"---> Scrolling to story at: %@ %d-%d", NSStringFromCGRect(frame), currentPage.pageIndex, currentIndex);
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
[self hideNotifier];
|
||||
|
||||
[currentPage realignScroll];
|
||||
}
|
||||
|
||||
- (void)refreshHeaders {
|
||||
|
|
Loading…
Add table
Reference in a new issue