mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user