Tweaks the scroll behavior when space bar is pressed

The overlap is 2 lines of text at the standard system font size.
This commit is contained in:
Brian Sanders 2020-06-07 20:05:56 -04:00
parent 702ce79bd5
commit 6aa7b009f8
1 changed files with 2 additions and 1 deletions

View File

@ -128,8 +128,9 @@ class WebViewController: UIViewController {
func scrollPageDown() {
guard let webView = webView else { return }
let overlap = 2 * UIFont.systemFont(ofSize: UIFont.systemFontSize).lineHeight * UIScreen.main.scale
let scrollToY: CGFloat = {
let fullScroll = webView.scrollView.contentOffset.y + webView.scrollView.layoutMarginsGuide.layoutFrame.height
let fullScroll = webView.scrollView.contentOffset.y + webView.scrollView.layoutMarginsGuide.layoutFrame.height - overlap
let final = finalScrollPosition()
return fullScroll < final ? fullScroll : final
}()