bug fix in single tap detection

pull/2/merge
Qingping Hou 12 years ago
parent 3486ae7e09
commit 032a71cbc4

@ -85,22 +85,17 @@ end
function GestureDetector:guessGesture()
local is_recognized = false
local result = nil
local last_ev = {pos = Geom:new{}}
local result = {ges = "tap", pos = Geom:new{w=0, h=0}}
for k,ev in ipairs(self.ev_stack) do
--@TODO do real recognization here (houqp)
is_recognized = true
result = {
ges = "tap",
pos = Geom:new{
x = ev.x or last_ev.x,
y = ev.y or last_ev.x,
w = 0,
h = 0,
}
}
last_ev = ev
if ev.x then
result.pos.x = ev.x
end
if ev.y then
result.pos.y = ev.y
end
end
if is_recognized then

@ -336,29 +336,6 @@ function Input:waitEvent(timeout_us, timeout_s)
if touch_ges then
return Event:new("Gesture", touch_ges)
end
--elseif ev.type == EV_ABS then
--if ev.code == ABS_MT_SLOT then
--DEBUG("MT_SLOT:", ev.value)
--elseif ev.code == ABS_MT_TRACKING_ID then
--DEBUG("MT_TRACK_ID:", ev.value)
--elseif ev.code == ABS_MT_POSITION_X then
--DEBUG("MT_X:", ev.value)
--elseif ev.code == ABS_MT_POSITION_Y then
--DEBUG("MT_Y:", ev.value)
--else
--DEBUG("unknown touch event!", ev)
--return Event:new("UnkonwnTouchEvent", ev)
--end
--elseif ev.type == EV_SYN then
--if ev.code == SYN_REPORT then
--DEBUG("SYN REPORT")
--elseif ev.code == SYN_MT_REPORT then
--DEBUG("SYN MT_REPORT")
--elseif ev.code == SYN_CONFIG then
--DEBUG("SYN CONFIG")
--else
--DEBUG(ev)
--end
else
-- some other kind of event that we do not know yet
return Event:new("GenericInput", ev)

Loading…
Cancel
Save