mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
first demo of screen rotate
This commit is contained in:
@@ -14,32 +14,7 @@ ReaderRolling = InputContainer:new{
|
||||
}
|
||||
|
||||
function ReaderRolling:init()
|
||||
if Device:isTouchDevice() then
|
||||
self.ges_events = {
|
||||
TapForward = {
|
||||
GestureRange:new{
|
||||
ges = "tap",
|
||||
range = Geom:new{
|
||||
x = Screen:getWidth()/4,
|
||||
y = Screen:getHeight()/4,
|
||||
w = 3*Screen:getWidth()/4,
|
||||
h = 5*Screen:getHeight()/8,
|
||||
}
|
||||
}
|
||||
},
|
||||
TapBackward = {
|
||||
GestureRange:new{
|
||||
ges = "tap",
|
||||
range = Geom:new{
|
||||
x = 0,
|
||||
y = Screen:getHeight()/4,
|
||||
w = Screen:getWidth()/4,
|
||||
h = 5*Screen:getHeight()/8,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events = {
|
||||
GotoNextView = {
|
||||
{ Input.group.PgFwd },
|
||||
@@ -89,6 +64,34 @@ function ReaderRolling:init()
|
||||
self.old_page = self.ui.document.info.number_of_pages
|
||||
end
|
||||
|
||||
-- This method will be called in onSetDimensions handler
|
||||
function ReaderRolling:initGesListener()
|
||||
self.ges_events = {
|
||||
TapForward = {
|
||||
GestureRange:new{
|
||||
ges = "tap",
|
||||
range = Geom:new{
|
||||
x = Screen:getWidth()/4,
|
||||
y = Screen:getHeight()/4,
|
||||
w = 3*Screen:getWidth()/4,
|
||||
h = 5*Screen:getHeight()/8,
|
||||
}
|
||||
}
|
||||
},
|
||||
TapBackward = {
|
||||
GestureRange:new{
|
||||
ges = "tap",
|
||||
range = Geom:new{
|
||||
x = 0,
|
||||
y = Screen:getHeight()/4,
|
||||
w = Screen:getWidth()/4,
|
||||
h = 5*Screen:getHeight()/8,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function ReaderRolling:onReadSettings(config)
|
||||
local soe = config:readSetting("show_overlap_enable")
|
||||
if not soe then
|
||||
@@ -223,6 +226,13 @@ function ReaderRolling:onRedrawCurrentView()
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderRolling:onSetDimensions()
|
||||
-- update listening according to new screen dimen
|
||||
if Device:isTouchDevice() then
|
||||
self:initGesListener()
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
PosUpdate event is used to signal other widgets that pos has been changed.
|
||||
--]]
|
||||
|
||||
Reference in New Issue
Block a user