Gestures: Allow disabling tap and/or swipes for page turns (#7572)

Co-authored-by: gbyl <gbyl@users.noreply.github.com>
Co-authored-by: NiLuJe <ninuje@gmail.com>
This commit is contained in:
gbyl
2021-04-22 11:35:08 -05:00
committed by GitHub
parent dde3c80e73
commit 617ed2c078
6 changed files with 77 additions and 25 deletions

View File

@@ -349,13 +349,21 @@ function ReaderRolling:setupTouchZones()
id = "tap_forward",
ges = "tap",
screen_zone = forward_zone,
handler = function() return self:onGotoViewRel(1) end,
handler = function()
if G_reader_settings:nilOrFalse("page_turns_disable_tap") then
return self:onGotoViewRel(1)
end
end,
},
{
id = "tap_backward",
ges = "tap",
screen_zone = backward_zone,
handler = function() return self:onGotoViewRel(-1) end,
handler = function()
if G_reader_settings:nilOrFalse("page_turns_disable_tap") then
return self:onGotoViewRel(-1)
end
end,
},
{
id = "rolling_swipe",
@@ -363,7 +371,7 @@ function ReaderRolling:setupTouchZones()
screen_zone = {
ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1,
},
handler = function(ges) return self:onSwipe(nil, ges) end
handler = function(ges) return self:onSwipe(nil, ges) end,
},
{
id = "rolling_pan",
@@ -372,7 +380,7 @@ function ReaderRolling:setupTouchZones()
screen_zone = {
ratio_x = 0, ratio_y = 0, ratio_w = 1, ratio_h = 1,
},
handler = function(ges) return self:onPan(nil, ges) end
handler = function(ges) return self:onPan(nil, ges) end,
},
})
end
@@ -509,16 +517,20 @@ end
function ReaderRolling:onSwipe(_, ges)
local direction = BD.flipDirectionIfMirroredUILayout(ges.direction)
if direction == "west" then
if self.inverse_reading_order then
self:onGotoViewRel(-1)
else
self:onGotoViewRel(1)
if G_reader_settings:nilOrFalse("page_turns_disable_swipe") then
if self.inverse_reading_order then
self:onGotoViewRel(-1)
else
self:onGotoViewRel(1)
end
end
elseif direction == "east" then
if self.inverse_reading_order then
self:onGotoViewRel(1)
else
self:onGotoViewRel(-1)
if G_reader_settings:nilOrFalse("page_turns_disable_swipe") then
if self.inverse_reading_order then
self:onGotoViewRel(1)
else
self:onGotoViewRel(-1)
end
end
else
-- update footer (time & battery)