|
|
|
@ -7,7 +7,6 @@ local GestureRange = require("ui/gesturerange")
|
|
|
|
|
local _ = require("gettext")
|
|
|
|
|
|
|
|
|
|
local ReaderRotation = InputContainer:new{
|
|
|
|
|
ROTATE_ANGLE_THRESHOLD = 15,
|
|
|
|
|
current_rotation = 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -25,21 +24,6 @@ function ReaderRotation:init()
|
|
|
|
|
event = "Rotate", args = 90 },
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
if Device:isTouchDevice() then
|
|
|
|
|
self.ges_events = {
|
|
|
|
|
RotateGes = {
|
|
|
|
|
GestureRange:new{
|
|
|
|
|
ges = "rotate",
|
|
|
|
|
range = Geom:new{
|
|
|
|
|
x = 0, y = 0,
|
|
|
|
|
w = Screen:getWidth(),
|
|
|
|
|
h = Screen:getHeight(),
|
|
|
|
|
},
|
|
|
|
|
rate = 0.3,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- TODO: reset rotation on new document, maybe on new page?
|
|
|
|
@ -50,15 +34,4 @@ function ReaderRotation:onRotate(rotate_by)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ReaderRotation:onRotateGes(arg, ges)
|
|
|
|
|
if ges.angle and ges.angle > self.ROTATE_ANGLE_THRESHOLD then
|
|
|
|
|
if Screen:getScreenMode() == "portrait" then
|
|
|
|
|
self.ui:handleEvent(Event:new("SetScreenMode", "landscape"))
|
|
|
|
|
else
|
|
|
|
|
self.ui:handleEvent(Event:new("SetScreenMode", "portrait"))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return ReaderRotation
|
|
|
|
|