ConfigDialog: fix ButtonProgressWidget and some refreshes (#4793)

This internal ButtonProgressWidget widget was behaving
differently from all others (OptionTextItem, OptionIconItem
and ToggleSwitch) by duplicating some code from
ConfigDialog:onConfigChoose() instead of calling it directly.

While making it similar to others, I noticed that onConfigChoose()
did a full repaint, which was necessary for some settings to
be applied (ie: Contrast).
On CreDocument, this full repaint may cause some double drawing
on config changes (ie: Margins, drawing once after margin changes,
and then re-positionning to previous xpointer).
So, make the need for full repaint a condition on KoptOptions.
This commit is contained in:
poire-z
2019-03-14 22:23:17 +01:00
committed by GitHub
parent 9560bc2061
commit c060595580
3 changed files with 32 additions and 6 deletions

View File

@@ -643,6 +643,15 @@ function ReaderRolling:onUpdatePos()
-- we have set above) to avoid multiple refreshes.
return true
end
-- Calling this now ensures the re-rendering is done by crengine
-- so the delayed updatePos() has good info and can reposition
-- the previous xpointer accurately:
self.ui.document:getCurrentPos()
-- Otherwise, _readMetadata() would do that, but the positionning
-- would not work as expected, for some reason (it worked
-- previously because of some bad setDirty() in ConfigDialog widgets
-- that were triggering a full repaint of crengine (so, the needed
-- rerendering) before updatePos() is called.
UIManager:scheduleIn(0.1, function () self:updatePos() end)
return true
end