mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
highlight current toc entry
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user