[feat, UX] Gesture manager: add support for diagonal swipes (#4710)

NB The north east and north west arrows are swapped, see https://github.com/koreader/koreader/issues/4707
This commit is contained in:
Frans de Jonge
2019-03-02 14:38:40 +01:00
committed by GitHub
parent 57ce8dc574
commit e4319ddaea

View File

@@ -92,7 +92,9 @@ local default_multiswipes = {
}
local multiswipes = {}
local multiswipes_info_text = _([[
Multiswipes allow you to perform complex gestures built up out of multiple straight swipes.]])
Multiswipes allow you to perform complex gestures built up out of multiple swipe directions, never losing touch with the screen.
These advanced gestures consist of either straight swipes or diagonal swipes. To ensure accuracy, they can't be mixed.]])
function ReaderGesture:init()
if not Device:isTouchDevice() then return end
@@ -388,16 +390,17 @@ function ReaderGesture:createSubMenu(text, action, ges, separator)
end
local multiswipe_to_arrow = {
east = "",
west = "",
north = "",
south = "",
east = "",
west = "",
north = "",
south = "",
northeast = "", -- @TODO swap back, see https://github.com/koreader/koreader/issues/4707
northwest = "", -- @TODO swap back, see https://github.com/koreader/koreader/issues/4707
southeast = "",
southwest = "",
}
function ReaderGesture:friendlyMultiswipeName(multiswipe)
for k, v in pairs(multiswipe_to_arrow) do
multiswipe = multiswipe:gsub(k, v)
end
return multiswipe
return multiswipe:gsub("%S+", multiswipe_to_arrow)
end
function ReaderGesture:safeMultiswipeName(multiswipe)