[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>.
pull/4699/head
Frans de Jonge 5 years ago committed by GitHub
parent cfd7fcb357
commit d8845f8589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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] = {

Loading…
Cancel
Save