ReaderToc: Unbreak ToC depth detection (#7569)

No need to reinvent the wheel.

Fix #7568, regression since #7553
pull/7570/head
NiLuJe 3 years ago committed by GitHub
parent 3df1ce3644
commit 9988eab1a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -668,7 +668,6 @@ function ReaderToc:onShowToc()
}
-- update collapsible state
local can_collapse = false
if #self.toc > 0 and #self.collapsed_toc == 0 then
local depth = 0
for i = #self.toc, 1, -1 do
@ -679,7 +678,6 @@ function ReaderToc:onShowToc()
callback = function() self:expandToc(i) end,
indent = self.toc_indent:rep(v.depth-1),
}
can_collapse = true
end
if v.depth < self.collapse_depth then
table.insert(self.collapsed_toc, 1, v)
@ -687,6 +685,7 @@ function ReaderToc:onShowToc()
depth = v.depth
end
end
local can_collapse = self:getMaxDepth() > 1
-- NOTE: If the ToC actually has multiple depth levels, we request smaller padding between items,
-- because we inflate the state Button's width on the left, mainly to give it a larger tap zone.

Loading…
Cancel
Save