Fixed #1614 (story traversal buttons shifted)

This commit is contained in:
David Sinclair 2022-02-01 20:40:07 -08:00
parent 51be5adcf6
commit af73ec4458
2 changed files with 10 additions and 16 deletions

View file

@ -1362,7 +1362,7 @@
CGFloat bottomInset = appDelegate.detailViewController.view.safeAreaInsets.bottom;
int safeBottomMargin = bottomInset / 2;
int safeBottomMargin = bottomInset;
int bottomPosition = webpageHeight - topPosition - viewportHeight;
BOOL singlePage = webpageHeight - 200 <= viewportHeight;
BOOL atBottom = bottomPosition < 150;
@ -1412,12 +1412,12 @@
appDelegate.storyPagesViewController.traverseView.alpha = 1;
// NSLog(@" ---> Bottom position: %d", bottomPosition);
if (bottomPosition >= 0 || !isHorizontal) {
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0;
} else {
if (webpageHeight > 0 && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) - safeBottomMargin;
} else {
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0;
}
}
} else if ((!singlePage && (atTop && !atBottom)) || [[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPhone) {
@ -1426,7 +1426,7 @@
appDelegate.storyPagesViewController.traverseFloating = NO;
[appDelegate.storyPagesViewController.view layoutIfNeeded];
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0;
[appDelegate.storyPagesViewController.view layoutIfNeeded];
[UIView animateWithDuration:.3 delay:0
options:UIViewAnimationOptionCurveEaseInOut
@ -1440,7 +1440,7 @@
appDelegate.storyPagesViewController.traverseFloating = YES;
[appDelegate.storyPagesViewController.view layoutIfNeeded];
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = safeBottomMargin;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = 0;
[appDelegate.storyPagesViewController.view layoutIfNeeded];
[UIView animateWithDuration:.3 delay:0
options:UIViewAnimationOptionCurveEaseInOut
@ -1454,7 +1454,7 @@
appDelegate.storyPagesViewController.traversePinned = NO;
appDelegate.storyPagesViewController.traverseFloating = YES;
appDelegate.storyPagesViewController.traverseView.alpha = 1;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin;
appDelegate.storyPagesViewController.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) - safeBottomMargin;
}
[appDelegate.storyPagesViewController resizeScrollView];

View file

@ -214,7 +214,7 @@
[self.view addConstraint:self.notifier.topOffsetConstraint];
[self.notifier hideNow];
self.traverseBottomConstraint.constant = appDelegate.detailViewController.view.safeAreaInsets.bottom / 2;
self.traverseBottomConstraint.constant = 0;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
appDelegate.detailViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:
@ -522,13 +522,7 @@
self.traverseFloating = NO;
if (!hide) {
int safeBottomMargin = 0;
if (self.isPhoneOrCompact) {
safeBottomMargin = appDelegate.detailViewController.view.safeAreaInsets.bottom / 2;
}
self.traverseBottomConstraint.constant = safeBottomMargin;
self.traverseBottomConstraint.constant = 0;
[self.view layoutIfNeeded];
}
}
@ -957,7 +951,7 @@
// Stick to bottom
traversePinned = YES;
self.traverseBottomConstraint.constant = appDelegate.detailViewController.view.safeAreaInsets.bottom / 2;
self.traverseBottomConstraint.constant = 0;
if (self.traverseView.alpha == 0) {
[UIView animateWithDuration:.24 delay:0