fix manager assignment
This commit is contained in:
14
src/node.cpp
14
src/node.cpp
@@ -340,21 +340,22 @@ void Node::removed(Node* parent)
|
||||
|
||||
const Node* Node::init_template(const char* id)
|
||||
{
|
||||
Node* m_template = nullptr;
|
||||
Node* t = nullptr;
|
||||
App::I->ui_task([&]
|
||||
{
|
||||
auto hid = const_hash(id);
|
||||
Node* top = m_manager->get(hid);
|
||||
m_template = static_cast<Node*>(top->m_children[0].get());
|
||||
for (auto& c : m_template->m_children)
|
||||
t = static_cast<Node*>(top->m_children[0].get());
|
||||
t->set_manager(m_manager);
|
||||
for (auto& c : t->m_children)
|
||||
{
|
||||
auto node = c->clone();
|
||||
add_child(node);
|
||||
}
|
||||
YGNodeCopyStyle(y_node, m_template->y_node);
|
||||
m_template->clone_copy(this);
|
||||
YGNodeCopyStyle(y_node, t->y_node);
|
||||
t->clone_copy(this);
|
||||
});
|
||||
return m_template;
|
||||
return t;
|
||||
}
|
||||
|
||||
bool Node::init_template_file(const std::string& path, const std::string& id)
|
||||
@@ -366,6 +367,7 @@ bool Node::init_template_file(const std::string& path, const std::string& id)
|
||||
if (m.load(path.c_str()))
|
||||
{
|
||||
auto t = m.get_ref(id.c_str())->m_children[0];
|
||||
t->set_manager(m_manager);
|
||||
for (auto& c : t->m_children)
|
||||
add_child(c->clone());
|
||||
YGNodeCopyStyle(y_node, t->y_node);
|
||||
|
||||
Reference in New Issue
Block a user