ReaderLink: Minor logic simplification in onGoToPageLink (#9987)

Abort earlier if the nearest link is too far, instead of computing stuff and creating an object we'll never actually use.

Includes minor logging tweaks to vaguely related codepaths ;p.
This commit is contained in:
NiLuJe
2023-01-03 20:48:49 +01:00
committed by GitHub
parent a8b333e4f9
commit 4ce0058e2d
3 changed files with 51 additions and 58 deletions

View File

@@ -816,7 +816,7 @@ function ReaderRolling:onRestoreBookLocation(saved_location)
end
function ReaderRolling:onGotoViewRel(diff)
logger.dbg("goto relative screen:", diff, ", in mode:", self.view.view_mode)
logger.dbg("goto relative screen:", diff, "in mode:", self.view.view_mode)
if self.view.view_mode == "scroll" then
local footer_height = ((self.view.footer_visible and not self.view.footer.settings.reclaim_height) and 1 or 0) * self.view.footer:getHeight()
local page_visible_height = self.ui.dimen.h - footer_height