Dispatcher: avoid multiple cre rerenderings when many settings changed (#9651)

When a gesture/profile was updating multiple cre settings,
each setting handler would emit UpdatePos which each would
force a re-rendering.
When this might be happening, postpone the rerendering
until all are set.
Needs some bit of refactoring to the events at play:
introduce "DocumentRerendered" event, and use it where
we used "UpdatePos" or "UpdateToc" to mean exactly that.
This commit is contained in:
poire-z
2022-10-25 13:16:01 +02:00
committed by GitHub
parent d1abbbfdd8
commit 48eb02318d
7 changed files with 58 additions and 28 deletions

View File

@@ -908,7 +908,6 @@ function ReaderFooter:disableFooter()
self.resetLayout = function() end
self.updateFooterPage = function() end
self.updateFooterPos = function() end
self.onUpdatePos = function() end
self.mode = self.mode_list.off
self.view.footer_visible = false
end
@@ -2225,6 +2224,8 @@ function ReaderFooter:_updateFooterText(force_repaint, force_recompute)
end
end
-- Note: no need for :onDocumentRerendered(), ReaderToc will catch "DocumentRerendered"
-- and will then emit a "TocReset" after the new ToC is made.
function ReaderFooter:onTocReset()
self:setTocMarkers(true)
if self.view.view_mode == "page" then
@@ -2263,10 +2264,6 @@ function ReaderFooter:onPosUpdate(pos, pageno)
self:updateFooterPos()
end
-- recalculate footer sizes when document page count is updated
-- see documentation for more info about this event.
ReaderFooter.onUpdatePos = ReaderFooter.onUpdateFooter
function ReaderFooter:onReaderReady()
self.ui.menu:registerToMainMenu(self)
self:setupTouchZones()