2
0
mirror of https://github.com/koreader/koreader synced 2024-11-11 19:11:14 +00:00

[fix] GestureDetector: only initiate multiswipe with clear N/S/E/W direction (#4698)

Accidentally lost while refacturing. See <https://github.com/koreader/koreader/pull/4640#issuecomment-468788986>.
This commit is contained in:
Frans de Jonge 2019-03-01 21:47:45 +01:00 committed by GitHub
parent cfd7fcb357
commit d8845f8589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -526,8 +526,14 @@ function GestureDetector:handlePan(tev)
local msd_direction_prev = (msd_cnt > 0) and self.multiswipe_directions[msd_cnt][1] or ""
local prev_ms_ev, fake_first_tev
if msd_cnt == 0 then
-- do not initiate multiswipe unless we have a clear north/south/east/west direction
if pan_direction ~= "north" and pan_direction ~= "south"
and pan_direction ~= "east" and pan_direction ~= "west" then
return pan_ev
end
-- recompute a more accurate direction and distance in a multiswipe context
if msd_cnt > 0 then
elseif msd_cnt > 0 then
prev_ms_ev = self.multiswipe_directions[msd_cnt][2]
fake_first_tev = {
[slot] = {