mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
customizable tap zones for page flipping and bookmarking
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local LeftContainer = require("ui/widget/container/leftcontainer")
|
||||
local ImageWidget = require("ui/widget/imagewidget")
|
||||
local GestureRange = require("ui/gesturerange")
|
||||
local Device = require("ui/device")
|
||||
local Geom = require("ui/geometry")
|
||||
local Screen = require("ui/screen")
|
||||
local Event = require("ui/event")
|
||||
|
||||
local ReaderFlipping = LeftContainer:new{
|
||||
local ReaderFlipping = InputContainer:new{
|
||||
orig_reflow_mode = 0,
|
||||
}
|
||||
|
||||
@@ -11,9 +15,30 @@ function ReaderFlipping:init()
|
||||
local widget = ImageWidget:new{
|
||||
file = "resources/icons/appbar.book.open.png",
|
||||
}
|
||||
local icon_size = widget:getSize()
|
||||
self.dimen = Geom:new{w = Screen:getWidth(), h = icon_size.h}
|
||||
self[1] = widget
|
||||
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()
|
||||
self.ui:handleEvent(Event:new("ToggleFlipping"))
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderFlipping:onSetFlippingMode(flipping_mode)
|
||||
|
||||
Reference in New Issue
Block a user