highlight current toc entry

This commit is contained in:
chrox
2014-04-04 23:02:29 +08:00
parent 9ee1352a76
commit ac396e3aa9
2 changed files with 21 additions and 3 deletions

View File

@@ -53,6 +53,10 @@ function ReaderToc:onUpdateToc()
return true
end
function ReaderToc:onPageUpdate(pageno)
self.pageno = pageno
end
function ReaderToc:fillToc()
self.toc = self.ui.document:getToc()
end
@@ -103,6 +107,16 @@ function ReaderToc:onShowToc()
v.mandatory = v.page
end
end
-- update current entry
if #self.toc > 0 then
for i=1, #self.toc do
v = self.toc[i]
if v.page > self.pageno then
self.toc.current = i > 1 and i - 1 or 1
break
end
end
end
local menu_container = CenterContainer:new{
dimen = Screen:getSize(),