mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Gesture to show only config menu (#3051)
* Gesture to show only config menu * Show config menu from bottom
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user