mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
feature: event can be now list of events
This commit is contained in:
parent
33c36f4967
commit
fdbacd033d
@ -145,6 +145,19 @@ local function notify_input_on_swipe(factory)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function match_event(action_id, events)
|
||||||
|
if type(events) == "table" then
|
||||||
|
for i = 1, #events do
|
||||||
|
if action_id == events[i] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return action_id == events
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Called ON_INPUT
|
--- Called ON_INPUT
|
||||||
function _factory.on_input(factory, action_id, action)
|
function _factory.on_input(factory, action_id, action)
|
||||||
if factory[data.ON_SWIPE] then
|
if factory[data.ON_SWIPE] then
|
||||||
@ -164,7 +177,7 @@ function _factory.on_input(factory, action_id, action)
|
|||||||
local len = #factory[data.ON_INPUT]
|
local len = #factory[data.ON_INPUT]
|
||||||
for i = len, 1, -1 do
|
for i = len, 1, -1 do
|
||||||
v = factory[data.ON_INPUT][i]
|
v = factory[data.ON_INPUT][i]
|
||||||
if action_id == v.event and v:on_input(action_id, action) then
|
if match_event(action_id, v.event) and v:on_input(action_id, action) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user