mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Remove match_event from druid, add hover component
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
-- @see druid.button
|
||||
-- @see druid.blocker
|
||||
-- @see druid.back_handler
|
||||
-- @see druid.input
|
||||
-- @see druid.text
|
||||
-- @see druid.locale
|
||||
-- @see druid.timer
|
||||
@@ -23,6 +24,7 @@ local class = require("druid.system.middleclass")
|
||||
local button = require("druid.base.button")
|
||||
local blocker = require("druid.base.blocker")
|
||||
local back_handler = require("druid.base.back_handler")
|
||||
local hover = require("druid.base.hover")
|
||||
local text = require("druid.base.text")
|
||||
local locale = require("druid.base.locale")
|
||||
local timer = require("druid.base.timer")
|
||||
@@ -33,7 +35,7 @@ local slider = require("druid.base.slider")
|
||||
local checkbox = require("druid.base.checkbox")
|
||||
local checkbox_group = require("druid.base.checkbox_group")
|
||||
local radio_group = require("druid.base.radio_group")
|
||||
local input - require("druid.base.input")
|
||||
local input = require("druid.base.input")
|
||||
-- local infinity_scroll = require("druid.base.infinity_scroll")
|
||||
local progress_rich = require("druid.rich.progress_rich")
|
||||
|
||||
@@ -94,19 +96,6 @@ local function notify_input_on_swipe(self)
|
||||
end
|
||||
|
||||
|
||||
local function match_event(action_id, events)
|
||||
if type(events) == const.TABLE then
|
||||
for i = 1, #events do
|
||||
if action_id == events[i] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
else
|
||||
return action_id == events
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Druid class constructor
|
||||
-- @function druid:initialize
|
||||
-- @tparam context table Druid context. Usually it is self of script
|
||||
@@ -200,7 +189,7 @@ function Druid.on_input(self, action_id, action)
|
||||
if components then
|
||||
for i = #components, 1, -1 do
|
||||
local v = components[i]
|
||||
if match_event(action_id, v.event) and v:on_input(action_id, action) then
|
||||
if v:on_input(action_id, action) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
@@ -262,6 +251,15 @@ function Druid.new_back_handler(self, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create hover basic component
|
||||
-- @function druid:new_hover
|
||||
-- @tparam args ... hover init args
|
||||
-- @treturn Component hover component
|
||||
function Druid.new_hover(self, ...)
|
||||
return Druid.create(self, hover, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create text basic component
|
||||
-- @function druid:new_text
|
||||
-- @tparam args ... text init args
|
||||
@@ -334,6 +332,15 @@ function Druid.new_checkbox(self, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create input basic component
|
||||
-- @function druid:new_input
|
||||
-- @tparam args ... input init args
|
||||
-- @treturn Component input component
|
||||
function Druid.new_input(self, ...)
|
||||
return Druid.create(self, input, ...)
|
||||
end
|
||||
|
||||
|
||||
--- Create checkbox_group basic component
|
||||
-- @function druid:new_checkbox_group
|
||||
-- @tparam args ... checkbox_group init args
|
||||
|
Reference in New Issue
Block a user