mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Add any link jump to the history.
Previously, if you follow a local link in the PDF file which points to a place only one page away from the current page and then press Back it will bring you to some random location (depending on the previous jump history). But normally you would expect to be returned to the link's location, regardless of its distance from the target page. This commit fixes this problem, also raised as an issue 575.
This commit is contained in:
parent
8f28fe8825
commit
12e713b285
@ -1579,14 +1579,16 @@ function UniReader:addBookmark(pageno)
|
||||
end
|
||||
|
||||
-- change current page and cache next page after rendering
|
||||
function UniReader:goto(no, is_ignore_jump)
|
||||
function UniReader:goto(no, is_ignore_jump, pos_type)
|
||||
local numpages = self.doc:getPages()
|
||||
if no < 1 or no > numpages then
|
||||
return
|
||||
end
|
||||
|
||||
-- for jump_history
|
||||
if not is_ignore_jump then
|
||||
if pos_type == "link" then
|
||||
self:addJump(self.pageno)
|
||||
elseif not is_ignore_jump then
|
||||
-- distinguish jump from normal page turn
|
||||
if self.pageno and math.abs(self.pageno - no) > 1 then
|
||||
self:addJump(self.pageno)
|
||||
|
Loading…
Reference in New Issue
Block a user