add two finger swipe gestures for showing TOC and bookmarks

two_finger_swipe to east is for TOC
two_finger_swipe to west is for bookmarks
pull/506/head
chrox 10 years ago
parent 4fcb39494c
commit f21d34f682

@ -39,6 +39,11 @@ function GestureRange:match(gs)
return false
end
end
if self.direction then
if self.direction ~= gs.direction then
return false
end
end
return true
end

@ -18,11 +18,26 @@ local ReaderBookmark = InputContainer:new{
function ReaderBookmark:init()
if Device:hasKeyboard() then
self.key_events = {
ShowToc = {
ShowBookmark = {
{ "B" },
doc = _("show bookmarks") },
}
end
if Device:isTouchDevice() then
self.ges_events = {
ShowBookmark = {
GestureRange:new{
ges = "two_finger_swipe",
range = Geom:new{
x = 0, y = 0,
w = Screen:getWidth(),
h = Screen:getHeight(),
},
direction = "west"
}
},
}
end
self.ui.menu:registerToMainMenu(self)
end

@ -1,6 +1,8 @@
local InputContainer = require("ui/widget/container/inputcontainer")
local CenterContainer = require("ui/widget/container/centercontainer")
local GestureRange = require("ui/gesturerange")
local Menu = require("ui/widget/menu")
local Geom = require("ui/geometry")
local Screen = require("ui/screen")
local Device = require("ui/device")
local UIManager = require("ui/uimanager")
@ -20,6 +22,21 @@ function ReaderToc:init()
doc = _("show Table of Content menu") },
}
end
if Device:isTouchDevice() then
self.ges_events = {
ShowToc = {
GestureRange:new{
ges = "two_finger_swipe",
range = Geom:new{
x = 0, y = 0,
w = Screen:getWidth(),
h = Screen:getHeight(),
},
direction = "east"
}
},
}
end
self.ui.menu:registerToMainMenu(self)
end

Loading…
Cancel
Save