2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

use shortcut_map to track page links

This commit is contained in:
Dobrica Pavlinusic 2012-09-26 10:55:03 +02:00
parent 771901d56e
commit 51e2a0c13b

View File

@ -2902,11 +2902,13 @@ function UniReader:addAllCommands()
Screen:saveCurrentBB() -- save dimmed links
local shortcut_offset = 0
local shortcut_map
local render_shortcuts = function()
Screen:restoreFromSavedBB()
local shortcut_nr = 1
shortcut_map = {}
for i = 1, #SelectMenu.item_shortcuts, 1 do
local link = links[ i + shortcut_offset ]
@ -2915,10 +2917,13 @@ function UniReader:addAllCommands()
if link.page then
local x,y,w,h = self:zoomedRectCoordTransform( link.x0,link.y0, link.x1,link.y1 )
renderUtf8Text(fb.bb, x, y + font_size - 1, face, SelectMenu.item_shortcuts[shortcut_nr])
shortcut_map[shortcut_nr] = i
shortcut_nr = shortcut_nr + 1
end
end
Debug("shortcut_map", shortcut_map)
fb:refresh(1)
end
@ -2961,7 +2966,7 @@ function UniReader:addAllCommands()
end
if link then
link = link + shortcut_offset
link = shortcut_map[ link + shortcut_offset ]
if links[link] ~= nil and links[link].page ~= nil then
goto_page = links[link].page + 1
else