Merge pull request #2135 from bdougsand/ipad-scrolling

Tweaks the scroll behavior when space bar is pressed
This commit is contained in:
Maurice Parker 2020-06-13 19:36:21 -05:00 committed by GitHub
commit df9a73716b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}()