mirror of
https://github.com/Insality/druid
synced 2025-09-28 10:32:20 +02:00
Add druid with context, get component druid as helper.get_druid(context)
This commit is contained in:
@@ -21,7 +21,7 @@ function M.set_state(self, state, is_silence)
|
||||
state_animate(self.node, state)
|
||||
|
||||
if not is_silence and self.callback then
|
||||
self.callback(self.parent.parent, state)
|
||||
self.callback(self.context, state)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,17 +32,18 @@ end
|
||||
|
||||
|
||||
-- TODO: pass self as first parameter
|
||||
local function on_click(context, self)
|
||||
local function on_click(self)
|
||||
M.set_state(self, not self.state)
|
||||
end
|
||||
|
||||
|
||||
function M.init(self, node, callback, click_node)
|
||||
self.druid = helper.get_druid(self)
|
||||
self.node = helper.node(node)
|
||||
self.click_node = helper.node(click_node)
|
||||
self.callback = callback
|
||||
|
||||
self.button = self.parent:new_button(self.click_node or self.node, on_click, self)
|
||||
self.button = self.druid:new_button(self.click_node or self.node, on_click)
|
||||
M.set_state(self, false, true)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user