TOC: expand to show all chapters on current page (#7339)

pull/7342/head
poire-z 3 years ago committed by GitHub
parent 64611e6acb
commit 37af0fd6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -757,7 +757,17 @@ function ReaderToc:onShowToc()
self:updateCurrentNode()
-- auto expand the parent node of current page
self:expandParentNode(self:getTocIndexByPage(self.pageno))
local idx = self:getTocIndexByPage(self.pageno)
if idx then
self:expandParentNode(idx)
-- Also do it for other toc items on current page
idx = idx + 1
while self.toc[idx] and self.toc[idx].page == self.pageno do
self:expandParentNode(idx)
idx = idx + 1
end
end
-- auto goto page of the current toc entry
self.toc_menu:switchItemTable(nil, self.collapsed_toc, self.collapsed_toc.current or -1)

Loading…
Cancel
Save