Reader: rationalize "Back" key/action handling (#6840)

Have ReaderBack be the sole handler of onBack.
Add 4 mutually exclusive options for the Back key,
to avoid ReaderLink and ReaderBack location stacks
from interfering (ReaderBack's stack being always a
superset of ReaderLink's stack).
So, remove "Enable back history", which is replaced
by Back option "Go to previous read page".
Fix a few possible crashes and inconsistencies (when
zoom, scroll or reflow have changed) with ReaderPaging
and ReaderView when restoring previous page/view.
This commit is contained in:
poire-z
2020-11-03 22:51:11 +01:00
committed by GitHub
parent 74c1813a82
commit 8403154d4d
9 changed files with 243 additions and 69 deletions

View File

@@ -668,13 +668,25 @@ function ReaderView:getViewContext()
end
function ReaderView:restoreViewContext(ctx)
-- The format of the context is different depending on page_scroll.
-- If we're asked to restore the other format, just ignore it
-- (our only caller, ReaderPaging:onRestoreBookLocation(), will
-- at least change to the page of the context, which is all that
-- can be done when restoring from a different mode)
if self.page_scroll then
self.page_states = ctx
if ctx[1] and ctx[1].visible_area then
self.page_states = ctx
return true
end
else
self.state = ctx[1]
self.visible_area = ctx[2]
self.page_area = ctx[3]
if ctx[1] and ctx[1].pos then
self.state = ctx[1]
self.visible_area = ctx[2]
self.page_area = ctx[3]
return true
end
end
return false
end
function ReaderView:onSetRotationMode(rotation)