fix layer order change

This commit is contained in:
2019-11-09 23:28:46 +01:00
parent a7511d3256
commit 8452bbe3e9
3 changed files with 17 additions and 6 deletions

View File

@@ -146,11 +146,11 @@ void NodePanelLayer::init()
ActionManager::add(a);
};
btn_add->on_click = [this](Node*) {
add_layer(true, true);
add_layer(true, true, m_layers_container->get_child_index(m_current_layer) + 1);
};
btn_remove->on_click = [this](Node*) {
if (m_layers.size() == 1)
return; // dont' delete the last layer
return; // don't delete the last layer
remove_layer(m_current_layer);
};
btn_up->on_click = [this](Node*) {
@@ -251,11 +251,11 @@ NodeLayer* NodePanelLayer::add_layer(const char* name, bool add_history /*= true
return l.get();
}
void NodePanelLayer::add_layer(bool add_history /*= true*/, bool create_events /*= false*/)
void NodePanelLayer::add_layer(bool add_history /*= true*/, bool create_events /*= false*/, int index /*= -1*/)
{
static char s[64];
sprintf(s, "Layer-%d", id_counter++);
add_layer(s, add_history, create_events);
add_layer(s, add_history, create_events, nullptr, nullptr, index);
}
NodeLayer* NodePanelLayer::get_layer_at(int index)