2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

add hold_release and hold_pan gestures

This commit is contained in:
chrox 2013-06-15 23:08:10 +08:00
parent 5bd4f9e94f
commit 6687208525

View File

@ -51,10 +51,12 @@ Current detectable gestures:
* pinch * pinch
* spread * spread
* rotate * rotate
* hold_pan
* double_tap * double_tap
* inward_pan * inward_pan
* outward_pan * outward_pan
* pan_release * pan_release
* hold_release
* two_finger_tap * two_finger_tap
* two_finger_pan * two_finger_pan
* two_finger_swipe * two_finger_swipe
@ -474,6 +476,7 @@ function GestureDetector:handlePan(tev)
y = self.last_tevs[slot].y, y = self.last_tevs[slot].y,
w = 0, h = 0, w = 0, h = 0,
} }
--DEBUG(pan_ev.ges, pan_ev.pos, pan_ev.direction, pan_ev.distance, "detected")
return pan_ev return pan_ev
end end
end end
@ -576,8 +579,7 @@ function GestureDetector:holdState(tev, hold)
}, },
time = tev.timev, time = tev.timev,
} }
end elseif tev.id == -1 and self.last_tevs[slot] ~= nil then
if tev.id == -1 and self.last_tevs[slot] ~= nil then
-- end of hold, signal hold release -- end of hold, signal hold release
DEBUG("hold_release detected in slot", slot) DEBUG("hold_release detected in slot", slot)
local last_x = self.last_tevs[slot].x local last_x = self.last_tevs[slot].x
@ -592,6 +594,10 @@ function GestureDetector:holdState(tev, hold)
}, },
time = tev.timev, time = tev.timev,
} }
else
local ges_ev = self:handlePan(tev)
ges_ev.ges = "hold_pan"
return ges_ev
end end
end end