Add component instance with general methods. New component constructor

This commit is contained in:
Insality
2020-01-30 01:46:02 +03:00
parent 0542ec4e69
commit ae47bcee8f
22 changed files with 156 additions and 114 deletions

View File

@@ -96,10 +96,10 @@ end
-- node - может брать ноду у компонента по схеме (если есть
-- template или таблица нод после gui.clone_tree)
function M.node(component, name)
local template_name = component.template or const.EMPTY_STRING
local template_name = component._meta.template or const.EMPTY_STRING
if component.nodes then
return component.nodes[template_name .. name]
if component._meta.nodes then
return component._meta.nodes[template_name .. name]
else
return gui.get_node(template_name .. name)
end
@@ -165,19 +165,4 @@ function M.get_pivot_offset(pivot)
end
function M.get_druid(self)
local context = { _context = self }
return setmetatable(context, { __index = self.context.druid })
end
function M.get_style(self, section)
if not self.druid_style then
return {}
end
return self.druid_style[section] or {}
end
return M