Update screensaver.lua

reviewable/pr11541/r4
SomeGuy 2 months ago committed by GitHub
parent ba2c21cb18
commit 7631255071
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -148,10 +148,12 @@ function Screensaver:expandSpecial(message, fallback)
time_left_chapter = self:_calcAverageTimeForPages(ui.toc:getChapterPagesLeft(currentpage) or doc:getTotalPagesLeft(currentpage))
time_left_document = self:_calcAverageTimeForPages(doc:getTotalPagesLeft(currentpage))
end
if currentpage == totalpages then
if currentpage == 1 then
percent = 0
elseif currentpage == totalpages then
percent = 100
else
percent = math.min( Math.round((currentpage * 100) / totalpages), 99)
percent = Math.round(Math.clamp(((currentpage * 100) / totalpages), 1, 99))
end
props = ui.doc_props
elseif DocSettings:hasSidecarFile(lastfile) then
@ -160,10 +162,12 @@ function Screensaver:expandSpecial(message, fallback)
totalpages = doc_settings:readSetting("doc_pages") or totalpages
percent = doc_settings:readSetting("percent_finished") or percent
currentpage = Math.round(percent * totalpages)
if currentpage == totalpages then
if currentpage == 1 then
percent = 0
elseif currentpage == totalpages then
percent = 100
else
percent = math.min( Math.round(percent * 100), 99)
percent = Math.round(Math.clamp(((currentpage * 100) / totalpages), 1, 99))
end
props = FileManagerBookInfo.extendProps(doc_settings:readSetting("doc_props"), lastfile)
-- Unable to set time_left_chapter and time_left_document without ReaderUI, so leave N/A

Loading…
Cancel
Save