Status bar fixes (#14518)

This commit is contained in:
hius07 authored and GitHub committed 2025-10-28 08:27:39 +02:00
1 parent 69f9e06747
commit b7d227a2cf
2 files changed
+44 -7

No files matched your search

+43 -7
View File
@@ -2116,14 +2116,10 @@ end
function ReaderFooter:onUpdateFooter(force_repaint, full_repaint)
if type(self.pageno) ~= "number" then return end
if self.progress_bar.initial_pos_marker then
self:updateProgressBarInitialPercentage()
end
if self.settings.chapter_progress_bar then
if self.progress_bar.initial_pos_marker then
if self.ui.toc:getNextChapter(self.pageno) == self.ui.toc:getNextChapter(self.initial_pageno) then
self.progress_bar.initial_percentage = self:getChapterProgress(true, self.initial_pageno)
else -- initial position is not in the current chapter
self.progress_bar.initial_percentage = -1 -- do not draw initial position marker
end
end
self.progress_bar:setPercentage(self:getChapterProgress(true))
else
self.progress_bar:setPercentage(self:getBookProgress())
@@ -2408,6 +2404,7 @@ function ReaderFooter:onToggleChapterProgressBar()
self:setTocMarkers()
if self.progress_bar.initial_pos_marker and not self.settings.chapter_progress_bar then
self.progress_bar.initial_percentage = self.initial_pageno / self.pages
-- initial marker position in the chapter progress bar is handled in onUpdateFooter
end
self:refreshFooter(true)
end
@@ -2419,6 +2416,45 @@ function ReaderFooter:invertProgressBar(invert_direction)
end
end
function ReaderFooter:updateProgressBarInitialPercentage()
-- If the progress bar shows the flow progress or the chapter progress,
-- the initial position marker may be out of the progress bar pages interval.
-- In that case set initial percentage to -1 to not draw the marker.
if self.ui.document:hasHiddenFlows() then
local initial_flow = self.ui.document:getPageFlow(self.initial_pageno)
local current_flow = self.ui.document:getPageFlow(self.pageno)
if initial_flow == current_flow then
if self.settings.chapter_progress_bar then
if initial_flow == 0 then -- in chapter progress bar, show initial marker for the main flow only
local initial_next_chapter = self.ui.toc:getNextChapter(self.initial_pageno)
local current_next_chapter = self.ui.toc:getNextChapter(self.pageno)
if initial_next_chapter == current_next_chapter then
self.progress_bar.initial_percentage = self:getChapterProgress(true, self.initial_pageno)
else
self.progress_bar.initial_percentage = -1
end
else
self.progress_bar.initial_percentage = -1
end
else
local page = self.ui.document:getPageNumberInFlow(self.initial_pageno)
local pages = self.ui.document:getTotalPagesInFlow(initial_flow)
self.progress_bar.initial_percentage = page / pages
end
else
self.progress_bar.initial_percentage = -1
end
elseif self.settings.chapter_progress_bar then
local initial_next_chapter = self.ui.toc:getNextChapter(self.initial_pageno)
local current_next_chapter = self.ui.toc:getNextChapter(self.pageno)
if initial_next_chapter == current_next_chapter then
self.progress_bar.initial_percentage = self:getChapterProgress(true, self.initial_pageno)
else
self.progress_bar.initial_percentage = -1
end
end
end
function ReaderFooter:getBookProgress()
if self.ui.document:hasHiddenFlows() then
local flow = self.ui.document:getPageFlow(self.pageno)
+1
View File
@@ -1231,6 +1231,7 @@ function PageBrowserWidget:onClose(close_all_parents)
-- As we're getting back to Reader, update the footer and the dogear state
-- (we may have toggled bookmark for current page) and do a full flashing
-- refresh to remove any ghost trace of thumbnails or black page slots
self.ui.view.footer:setTocMarkers(true)
UIManager:broadcastEvent(Event:new("UpdateFooter"))
self.ui.bookmark:onPageUpdate(self.ui:getCurrentPage())
UIManager:setDirty(self.ui.dialog, "full")