Show controls when hitting bottom of reader

This commit is contained in:
Jackson Harper
2023-12-12 12:35:19 +08:00
parent 0529792f2a
commit 421de02969

View File

@ -121,6 +121,12 @@ extension WebReaderCoordinator: WKNavigationDelegate {
scrollView.contentInset.top = navBarVisible ? readerViewNavBarHeight : 0
}
// if at bottom show the controls
if yOffset + scrollView.visibleSize.height > scrollView.contentSize.height - 140 {
navBarVisible = true
scrollView.contentInset.top = navBarVisible ? readerViewNavBarHeight : 0
}
let percent = Int(((yOffset + scrollView.visibleSize.height) / scrollView.contentSize.height) * 100)
scrollPercentHandler(max(0, min(percent, 100)))
}