From 6687208525c3ce76837f819f1014919d9cb16755 Mon Sep 17 00:00:00 2001 From: chrox Date: Sat, 15 Jun 2013 23:08:10 +0800 Subject: [PATCH] add hold_release and hold_pan gestures --- frontend/ui/gesturedetector.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/ui/gesturedetector.lua b/frontend/ui/gesturedetector.lua index c58b3a93f..02af6557d 100644 --- a/frontend/ui/gesturedetector.lua +++ b/frontend/ui/gesturedetector.lua @@ -51,10 +51,12 @@ Current detectable gestures: * pinch * spread * rotate + * hold_pan * double_tap * inward_pan * outward_pan * pan_release + * hold_release * two_finger_tap * two_finger_pan * two_finger_swipe @@ -474,6 +476,7 @@ function GestureDetector:handlePan(tev) y = self.last_tevs[slot].y, w = 0, h = 0, } + --DEBUG(pan_ev.ges, pan_ev.pos, pan_ev.direction, pan_ev.distance, "detected") return pan_ev end end @@ -576,8 +579,7 @@ function GestureDetector:holdState(tev, hold) }, time = tev.timev, } - end - if tev.id == -1 and self.last_tevs[slot] ~= nil then + elseif tev.id == -1 and self.last_tevs[slot] ~= nil then -- end of hold, signal hold release DEBUG("hold_release detected in slot", slot) local last_x = self.last_tevs[slot].x @@ -592,6 +594,10 @@ function GestureDetector:holdState(tev, hold) }, time = tev.timev, } + else + local ges_ev = self:handlePan(tev) + ges_ev.ges = "hold_pan" + return ges_ev end end