2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
koreader/frontend/apps/reader/modules/readerflipping.lua

45 lines
1.3 KiB
Lua
Raw Normal View History

local InputContainer = require("ui/widget/container/inputcontainer")
2013-10-18 20:38:07 +00:00
local LeftContainer = require("ui/widget/container/leftcontainer")
local ImageWidget = require("ui/widget/imagewidget")
local GestureRange = require("ui/gesturerange")
local Device = require("ui/device")
2013-10-18 20:38:07 +00:00
local Geom = require("ui/geometry")
local Screen = require("ui/screen")
local Event = require("ui/event")
local ReaderFlipping = InputContainer:new{
2014-03-13 13:52:43 +00:00
orig_reflow_mode = 0,
2013-03-31 13:37:57 +00:00
}
function ReaderFlipping:init()
2014-03-13 13:52:43 +00:00
local widget = ImageWidget:new{
file = "resources/icons/appbar.book.open.png",
}
self[1] = LeftContainer:new{
dimen = Geom:new{w = Screen:getWidth(), h = widget:getSize().h},
widget,
}
if Device:isTouchDevice() then
self.ges_events = {
Tap = {
GestureRange:new{
ges = "tap",
range = Geom:new{
x = Screen:getWidth()*DTAP_ZONE_FLIPPING.x,
y = Screen:getHeight()*DTAP_ZONE_FLIPPING.y,
w = Screen:getWidth()*DTAP_ZONE_FLIPPING.w,
h = Screen:getHeight()*DTAP_ZONE_FLIPPING.h
}
}
}
}
end
end
function ReaderFlipping:onTap()
2014-03-13 13:52:43 +00:00
self.ui:handleEvent(Event:new("TogglePageFlipping"))
return true
end
2013-10-18 20:38:07 +00:00
return ReaderFlipping