ReaderRolling: fix a few re-rendering issues

When switching screen rotation, have the re-rendering
properly done only via :onUpdatePos().
When changing alt status bar font size, also have it
done via :onUpdatePos() instead of the next painting
(this also update any dogear position after the resize).
When in scroll mode (no alt status bar), be sure to
draw crengine progress bar at top (and not below the
not shown alt status bar).
This commit is contained in:
poire-z
2021-12-07 17:53:10 +01:00
parent 8daf5dd4f6
commit 301eb387e9
2 changed files with 7 additions and 18 deletions

View File

@@ -908,7 +908,7 @@ function ReaderRolling:updatePos()
end
self:onUpdateTopStatusBarMarkers()
UIManager:setDirty(self.view.dialog, "partial")
self.current_header_height = self.ui.document:getHeaderHeight()
self.current_header_height = self.view.view_mode == "page" and self.ui.document:getHeaderHeight() or 0
-- Allow for the new rendering to be shown before possibly showing
-- the "Styles have changed..." ConfirmBox so the user can decide
-- if it is really needed
@@ -917,14 +917,9 @@ function ReaderRolling:updatePos()
end)
end
--[[
switching screen mode should not change current page number
--]]
function ReaderRolling:onChangeViewMode()
self.rendering_hash = self.ui.document:getDocumentRenderingHash()
self.ui.document:_readMetadata()
self.current_header_height = self.ui.document:getHeaderHeight()
self.ui:handleEvent(Event:new("UpdateToc"))
self.current_header_height = self.view.view_mode == "page" and self.ui.document:getHeaderHeight() or 0
-- Restore current position when switching page/scroll mode
if self.xpointer then
self:_gotoXPointer(self.xpointer)
-- Ensure a whole screen refresh is always enqueued
@@ -960,8 +955,7 @@ function ReaderRolling:onSetDimensions(dimen)
self.ui.document:enableInternalHistory(true)
-- Set document dimensions
self.ui.document:setViewDimen(Screen:getSize())
-- Re-setup previous position
self:onChangeViewMode()
-- Re-render document (and update TOC, re set position)
self:onUpdatePos()
-- Re-disable internal history, with required redraw
self.ui.document:enableInternalHistory(false)