readerfooter(fix): only populate footer info after document is loaded

pull/2061/head
Qingping Hou 8 years ago
parent 861e50c0aa
commit f71534e399

@ -314,7 +314,13 @@ function ReaderFooter:updateFooterPos()
self:updateFooterText()
end
-- updateFooterText will start as a noop. After onReaderReady event is
-- received, it will initialized as _updateFooterText
function ReaderFooter:updateFooterText()
end
-- only call this function after document is fully loaded
function ReaderFooter:_updateFooterText()
if self.settings.toc_markers and self.progress_bar.ticks == nil then
local ticks_candidates = {}
if self.ui.toc then
@ -410,6 +416,10 @@ function ReaderFooter:onUpdatePos()
self:updateFooter()
end
function ReaderFooter:onReaderReady()
self.updateFooterText = self._updateFooterText
self:updateFooter()
end
function ReaderFooter:applyFooterMode(mode)
-- three modes switcher for reader footer

@ -321,7 +321,7 @@ function ReaderUI:init()
v()
end
-- After initialisation notify that document is loaded
-- After initialisation notify that document is loaded and rendered
-- CREngine only reports correct page count after rendering is done
-- Need the same event for PDF document
self:handleEvent(Event:new("ReaderReady", self.doc_settings))

Loading…
Cancel
Save