[fix] Avoid multiple refreshes when opening credocuments (#3300)

Only noticeable on Kindle (which uses REAGL as partial refresh).
This commit is contained in:
poire-z
2017-10-05 17:12:49 +02:00
committed by Frans de Jonge
parent 34ad91c3f0
commit 301892f4b6

View File

@@ -97,6 +97,9 @@ function ReaderRolling:init()
self.ui.document:_readMetadata()
self.old_page = self.ui.document.info.number_of_pages
end)
table.insert(self.ui.postReaderCallback, function()
self:updatePos()
end)
self.ui.menu:registerToMainMenu(self)
end
@@ -466,6 +469,12 @@ end
Note that xpointer should not be changed.
--]]
function ReaderRolling:onUpdatePos()
if self.ui.postReaderCallback ~= nil then -- ReaderUI:init() not yet done
-- Don't schedule any updatePos as long as ReaderUI:init() is
-- not finished (one will be called in the ui.postReaderCallback
-- we have set above) to avoid multiple refreshes.
return true
end
UIManager:scheduleIn(0.1, function () self:updatePos() end)
return true
end