-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
There is issue in gesture module after last commit.
Two finger gesture state not properly clears.
Problem:
if action.touch then
if settings.multi_touch then
if #action.touch == 2 then
local t1 = action.touch[1]
local t2 = action.touch[2]
if current_touch_count < 2 then
multi_states[t1.id] = create_touch_state()
multi_states[t2.id] = create_touch_state()
t1.pressed = true
t2.pressed = true
end
handle_multi_touch(t1, t2) -- gesture state clears here
end
current_touch_count = #action.touch
-- but if we get a multi-touch with one finger, it will not be cleared here
-- the state will be saved from the previous two-finger gesture
return gestures
end
endPossible solution:
if action.touch then
if settings.multi_touch then
local was_handled = false -- save if multi touch gesture was handled
if #action.touch == 2 then
local t1 = action.touch[1]
local t2 = action.touch[2]
if current_touch_count < 2 then
multi_states[t1.id] = create_touch_state()
multi_states[t2.id] = create_touch_state()
t1.pressed = true
t2.pressed = true
end
was_handled = true -- gesture was handled
handle_multi_touch(t1, t2)
end
current_touch_count = #action.touch
if not was_handled then -- if not we manually clear gesture state
clear_gesture_state()
end
return gestures
end
endMetadata
Metadata
Assignees
Labels
No labels