Gesture to show only config menu (#3051)

* Gesture to show only config menu

* Show config menu from bottom
pull/3053/head
Robert 7 years ago committed by Frans de Jonge
parent 4b9fc6333f
commit 21c63a297e

@ -69,7 +69,7 @@ FOLLOW_LINK_TIMEOUT = 0.5
-- w: width of tap zone in proportion of screen width
-- h: height of tap zone in proportion of screen height
DTAP_ZONE_MENU = {x = 1/8, y = 0, w = 3/4, h = 1/8}
DTAP_ZONE_CONFIG = {x = 0, y = 0, w = 0, h = 0}
DTAP_ZONE_CONFIG = {x = 1/8, y = 7/8, w = 3/4, h = 1/8}
DTAP_ZONE_MINIBAR = {x = 0, y = 15/16, w = 1, h = 1/16}
DTAP_ZONE_FORWARD = {x = 1/4, y = 0, w = 3/4, h = 1}
DTAP_ZONE_BACKWARD = {x = 0, y = 0, w = 1/4, h = 1}

@ -1,10 +1,8 @@
local ConfigDialog = require("ui/widget/configdialog")
local InputContainer = require("ui/widget/container/inputcontainer")
local Device = require("device")
local GestureRange = require("ui/gesturerange")
local Geom = require("ui/geometry")
local Screen = require("device").screen
local Event = require("ui/event")
local Geom = require("ui/geometry")
local InputContainer = require("ui/widget/container/inputcontainer")
local UIManager = require("ui/uimanager")
local _ = require("gettext")
@ -25,19 +23,28 @@ function ReaderConfig:init()
end
function ReaderConfig:initGesListener()
self.ges_events = {
TapShowConfigMenu = {
GestureRange:new{
ges = "tap",
range = Geom:new{
x = Screen:getWidth()*DTAP_ZONE_CONFIG.x,
y = Screen:getHeight()*DTAP_ZONE_CONFIG.y,
w = Screen:getWidth()*DTAP_ZONE_CONFIG.w,
h = Screen:getHeight()*DTAP_ZONE_CONFIG.h,
}
}
}
}
self.ui:registerTouchZones({
{
id = "readerconfigmenu_tap",
ges = "tap",
screen_zone = {
ratio_x = DTAP_ZONE_CONFIG.x, ratio_y = DTAP_ZONE_CONFIG.y,
ratio_w = DTAP_ZONE_CONFIG.w, ratio_h = DTAP_ZONE_CONFIG.h,
},
overrides = { 'tap_forward', 'tap_backward', },
handler = function() return self:onTapShowConfigMenu() end,
},
{
id = "readerconfigmenu_swipe",
ges = "swipe",
screen_zone = {
ratio_x = DTAP_ZONE_CONFIG.x, ratio_y = DTAP_ZONE_CONFIG.y,
ratio_w = DTAP_ZONE_CONFIG.w, ratio_h = DTAP_ZONE_CONFIG.h,
},
overrides = { "rolling_swipe", "paging_swipe", },
handler = function(ges) return self:onSwipeShowConfigMenu(ges) end,
},
})
end
function ReaderConfig:onShowConfigMenu()
@ -62,6 +69,13 @@ function ReaderConfig:onTapShowConfigMenu()
return true
end
function ReaderConfig:onSwipeShowConfigMenu(ges)
if ges.direction == "north" then
self:onShowConfigMenu()
return true
end
end
function ReaderConfig:onSetDimensions(dimen)
if Device:isTouchDevice() then
self:initGesListener()

@ -233,7 +233,7 @@ function ReaderFooter:setupTouchZones()
screen_zone = footer_screen_zone,
handler = function(ges) return self:onTapFooter(ges) end,
overrides = {
'tap_forward', 'tap_backward',
'tap_forward', 'tap_backward', 'readerconfigmenu_tap',
},
},
{

@ -29,7 +29,7 @@ function ReaderHighlight:setupTouchZones()
screen_zone = {
ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1,
},
overrides = { 'tap_forward', 'tap_backward', 'readermenu_tap' },
overrides = { 'tap_forward', 'tap_backward', 'readermenu_tap', 'readerconfigmenu_tap', },
handler = function(ges) return self:onTap(nil, ges) end
},
{

Loading…
Cancel
Save