2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00
koreader/frontend/apps/reader/modules/readerhinting.lua

38 lines
992 B
Lua
Raw Normal View History

2013-10-18 20:38:07 +00:00
local EventListener = require("ui/widget/eventlistener")
2013-10-18 20:38:07 +00:00
local ReaderHinting = EventListener:new{
2014-03-13 13:52:43 +00:00
hinting_states = {}
}
function ReaderHinting:onHintPage()
2014-03-13 13:52:43 +00:00
if not self.view.hinting then return true end
for i=1, DHINTCOUNT do
if self.view.state.page + i <= self.document.info.number_of_pages then
self.document:hintPage(
2014-03-13 13:52:43 +00:00
self.view.state.page + i,
self.zoom:getZoom(self.view.state.page + i),
self.view.state.rotation,
self.view.state.gamma,
self.view.render_mode)
end
end
return true
end
function ReaderHinting:onSetHinting(hinting)
2014-03-13 13:52:43 +00:00
self.view.hinting = hinting
end
function ReaderHinting:onDisableHinting()
2014-03-13 13:52:43 +00:00
table.insert(self.hinting_states, self.view.hinting)
self.view.hinting = false
return true
end
function ReaderHinting:onRestoreHinting()
2014-03-13 13:52:43 +00:00
self.view.hinting = table.remove(self.hinting_states)
return true
end
2013-10-18 20:38:07 +00:00
return ReaderHinting