mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add last read page/percent setting support
This commit is contained in:
@@ -31,10 +31,6 @@ function ReaderRolling:init()
|
||||
self.old_doc_height = self.doc_height
|
||||
end
|
||||
|
||||
function ReaderRolling:onPosUpdate(new_pos)
|
||||
self.current_pos = new_pos
|
||||
end
|
||||
|
||||
function ReaderRolling:gotoPos(new_pos)
|
||||
if new_pos == self.current_pos then return end
|
||||
if new_pos < 0 then new_pos = 0 end
|
||||
@@ -46,6 +42,14 @@ function ReaderRolling:gotoPercent(new_percent)
|
||||
self:gotoPos(new_percent * self.doc_height / 10000)
|
||||
end
|
||||
|
||||
function ReaderRolling:onReadSettings(config)
|
||||
self:gotoPercent(config:readSetting("last_percent") or 0)
|
||||
end
|
||||
|
||||
function ReaderRolling:onPosUpdate(new_pos)
|
||||
self.current_pos = new_pos
|
||||
end
|
||||
|
||||
-- remember to signal this event the document has been zoomed,
|
||||
-- font has been changed, or line height has been changed.
|
||||
function ReaderRolling:onUpdatePos()
|
||||
@@ -84,3 +88,8 @@ function ReaderRolling:onZoom()
|
||||
--@TODO re-read doc_height info after font or lineheight changes 05.06 2012 (houqp)
|
||||
self:onUpdatePos()
|
||||
end
|
||||
|
||||
function ReaderRolling:onCloseDocument()
|
||||
self.ui.doc_settings:saveSetting("last_percent",
|
||||
10000 * self.current_pos / self.doc_height)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user