first demo of screen rotate

This commit is contained in:
Qingping Hou
2013-02-02 14:36:29 +08:00
parent 78691fd499
commit d4ff6f9291
14 changed files with 482 additions and 333 deletions

View File

@@ -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.
--]]