mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 18:37:44 +02:00
dont activate button, if disabled
This commit is contained in:
parent
a56c691e86
commit
c80ea35060
@ -64,6 +64,10 @@ end
|
|||||||
-- @param action_id - input action id
|
-- @param action_id - input action id
|
||||||
-- @param action - input action
|
-- @param action - input action
|
||||||
function M.on_input(instance, action_id, action)
|
function M.on_input(instance, action_id, action)
|
||||||
|
if not helper.is_enabled(instance.node) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if gui.pick_node(instance.node, action.x, action.y) then
|
if gui.pick_node(instance.node, action.x, action.y) then
|
||||||
if action.pressed then
|
if action.pressed then
|
||||||
-- Can interact if start touch on the button
|
-- Can interact if start touch on the button
|
||||||
|
@ -36,4 +36,15 @@ function M.step(current, target, step)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function M.is_enabled(node)
|
||||||
|
local is_enabled = gui.is_enabled(node)
|
||||||
|
local parent = gui.get_parent(node)
|
||||||
|
while parent and is_enabled do
|
||||||
|
is_enabled = is_enabled and gui.is_enabled(parent)
|
||||||
|
parent = gui.get_parent(parent)
|
||||||
|
end
|
||||||
|
return is_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
Loading…
x
Reference in New Issue
Block a user