mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Merge pull request #2438 from koreader/houqp-master
override reader menu touch zone with reader footer
This commit is contained in:
commit
1a83eb5725
@ -211,14 +211,20 @@ function ReaderFooter:setupTouchZones()
|
||||
}
|
||||
self.ui:registerTouchZones({
|
||||
{
|
||||
id = "footer_tap",
|
||||
id = "readerfooter_tap",
|
||||
ges = "tap",
|
||||
screen_zone = footer_screen_zone,
|
||||
handler = function() return self:onTapFooter() end,
|
||||
overrides = { 'tap_forward', 'tap_backward', },
|
||||
overrides = {
|
||||
'tap_forward', 'tap_backward',
|
||||
-- NOTE: readermenu_tap override is needed to keep behavior
|
||||
-- consistent with the old code base in case of overlap between
|
||||
-- footer and menu tap zones
|
||||
'readermenu_tap',
|
||||
},
|
||||
},
|
||||
{
|
||||
id = "footer_hold",
|
||||
id = "readerfooter_hold",
|
||||
ges = "hold",
|
||||
screen_zone = footer_screen_zone,
|
||||
handler = function() return self:onHoldFooter() end,
|
||||
|
@ -1,9 +1,7 @@
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local CenterContainer = require("ui/widget/container/centercontainer")
|
||||
local GestureRange = require("ui/gesturerange")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Device = require("device")
|
||||
local Geom = require("ui/geometry")
|
||||
local Screensaver = require("ui/screensaver")
|
||||
local Event = require("ui/event")
|
||||
local Screen = require("device").screen
|
||||
@ -74,20 +72,23 @@ function ReaderMenu:init()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderMenu:initGesListener()
|
||||
self.ges_events = {
|
||||
TapShowMenu = {
|
||||
GestureRange:new{
|
||||
ges = "tap",
|
||||
range = Geom:new{
|
||||
x = Screen:getWidth()*DTAP_ZONE_MENU.x,
|
||||
y = Screen:getHeight()*DTAP_ZONE_MENU.y,
|
||||
w = Screen:getWidth()*DTAP_ZONE_MENU.w,
|
||||
h = Screen:getHeight()*DTAP_ZONE_MENU.h
|
||||
}
|
||||
}
|
||||
function ReaderMenu:onReaderReady()
|
||||
-- deligate gesture listener to readerui
|
||||
self.ges_events = {}
|
||||
self.onGesture = nil
|
||||
if not Device:isTouchDevice() then return end
|
||||
|
||||
self.ui:registerTouchZones({
|
||||
{
|
||||
id = "readermenu_tap",
|
||||
ges = "tap",
|
||||
screen_zone = {
|
||||
ratio_x = DTAP_ZONE_MENU.x, ratio_y = DTAP_ZONE_MENU.y,
|
||||
ratio_w = DTAP_ZONE_MENU.w, ratio_h = DTAP_ZONE_MENU.h,
|
||||
},
|
||||
handler = function() return self:onTapShowMenu() end,
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
function ReaderMenu:setUpdateItemTable()
|
||||
@ -227,13 +228,6 @@ function ReaderMenu:onTapCloseMenu()
|
||||
self.ui:handleEvent(Event:new("CloseConfigMenu"))
|
||||
end
|
||||
|
||||
function ReaderMenu:onSetDimensions(dimen)
|
||||
-- update listening according to new screen dimen
|
||||
if Device:isTouchDevice() then
|
||||
self:initGesListener()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderMenu:onReadSettings(config)
|
||||
self.last_tab_index = config:readSetting("readermenu_tab_index") or 1
|
||||
end
|
||||
|
@ -174,7 +174,7 @@ Updates touch zones based on new screen dimensions.
|
||||
]]
|
||||
function InputContainer:updateTouchZonesOnScreenResize(new_screen_dimen)
|
||||
for _, tzone in ipairs(self._touch_zones) do
|
||||
local range = tzone.gs_range
|
||||
local range = tzone.gs_range.range
|
||||
range.x = new_screen_dimen.w * tzone.def.screen_zone.ratio_x
|
||||
range.y = new_screen_dimen.h * tzone.def.screen_zone.ratio_y
|
||||
range.w = new_screen_dimen.w * tzone.def.screen_zone.ratio_w
|
||||
|
Loading…
Reference in New Issue
Block a user