layer highlight when selected

This commit is contained in:
2017-08-11 19:07:48 +01:00
parent 9be2e8e147
commit 10fecd46b0
8 changed files with 59 additions and 21 deletions

View File

@@ -77,8 +77,14 @@ kEventResult NodeLayer::handle_event(Event* e)
m_selected = true;
if (on_selected)
on_selected(this);
if (on_highlight)
on_highlight(this, true);
mouse_capture();
break;
case kEventType::MouseUpL:
if (on_highlight)
on_highlight(this, false);
mouse_release();
break;
default:
return kEventResult::Available;
@@ -167,6 +173,7 @@ void NodePanelLayer::add_layer(const char* name)
l->on_selected = std::bind(&NodePanelLayer::handle_layer_selected, this, std::placeholders::_1);
l->on_opacity_changed = std::bind(&NodePanelLayer::handle_layer_opacity, this, std::placeholders::_1, std::placeholders::_2);
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);
if (m_current_layer)
m_current_layer->m_selected = false;
m_current_layer = l;
@@ -207,6 +214,12 @@ void NodePanelLayer::handle_layer_opacity(NodeLayer* target, float value)
on_layer_opacity_changed(this, m_layers_container->get_child_index(target), value);
}
void NodePanelLayer::handle_layer_highlight(NodeLayer* target, bool highlight)
{
if (on_layer_highlight_changed)
on_layer_highlight_changed(this, m_layers_container->get_child_index(target), highlight);
}
void NodePanelLayer::handle_layer_visibility(NodeLayer* target, bool visible)
{
if (on_layer_visibility_changed)