improve mouse events propagation

This commit is contained in:
2019-07-28 08:29:05 +02:00
parent ae5da7139c
commit 4ab35c6e9b
2 changed files with 14 additions and 3 deletions

View File

@@ -210,6 +210,11 @@ NodeLayer* NodePanelLayer::add_layer(const char* name, bool add_history /*= true
l->on_selected = std::bind(&NodePanelLayer::handle_layer_selected, this, std::placeholders::_1);
l->on_visibility_changed = std::bind(&NodePanelLayer::handle_layer_visibility, this, std::placeholders::_1, std::placeholders::_2);
l->on_highlight = std::bind(&NodePanelLayer::handle_layer_highlight, this, std::placeholders::_1, std::placeholders::_2);
// reset selected state
for (const auto& c : m_layers_container->m_children)
((NodeLayer*)c.get())->m_selected = false;
if (m_current_layer)
m_current_layer->m_selected = false;
m_current_layer = l.get();
@@ -268,6 +273,11 @@ void NodePanelLayer::remove_layer(NodeLayer* layer, bool add_history /*= true*/)
m_layers_container->remove_child(layer);
m_layers.erase(it);
i = std::min<int>(i, (int)m_layers.size() - 1);
// reset selected state
for (const auto& c : m_layers_container->m_children)
((NodeLayer*)c.get())->m_selected = false;
m_current_layer = (NodeLayer*)m_layers_container->get_child_at(i);
m_current_layer->m_selected = true;