mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Gesture manager: corner gestures (#4878)
Adds configuration to the top corners as well as the additional gestures hold and two-finger tap. Deprecates `DTAP_ZONE_FLIPPING` and `DTAP_ZONE_BOOKMARK`. Fixes #4877.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
local Geom = require("ui/geometry")
|
||||
local ImageWidget = require("ui/widget/imagewidget")
|
||||
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("device")
|
||||
local Geom = require("ui/geometry")
|
||||
local Screen = require("device").screen
|
||||
local Event = require("ui/event")
|
||||
|
||||
local ReaderFlipping = InputContainer:new{
|
||||
orig_reflow_mode = 0,
|
||||
@@ -25,36 +22,9 @@ end
|
||||
function ReaderFlipping:resetLayout()
|
||||
local new_screen_width = Screen:getWidth()
|
||||
if new_screen_width == self._last_screen_width then return end
|
||||
local new_screen_height = Screen:getHeight()
|
||||
self._last_screen_width = new_screen_width
|
||||
|
||||
self[1].dimen.w = new_screen_width
|
||||
if Device:isTouchDevice() then
|
||||
self.ges_events = {
|
||||
Tap = {
|
||||
GestureRange:new{
|
||||
ges = "tap",
|
||||
range = Geom:new{
|
||||
x = new_screen_width*DTAP_ZONE_FLIPPING.x,
|
||||
y = new_screen_height*DTAP_ZONE_FLIPPING.y,
|
||||
w = new_screen_width*DTAP_ZONE_FLIPPING.w,
|
||||
h = new_screen_height*DTAP_ZONE_FLIPPING.h
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFlipping:onTap()
|
||||
if not self.ui.document.info.has_pages then
|
||||
-- ReaderRolling has no support (yet) for onTogglePageFlipping,
|
||||
-- so don't make that top left tap area unusable (and allow
|
||||
-- taping on links there)
|
||||
return false
|
||||
end
|
||||
self.ui:handleEvent(Event:new("TogglePageFlipping"))
|
||||
return true
|
||||
end
|
||||
|
||||
return ReaderFlipping
|
||||
|
||||
Reference in New Issue
Block a user