fix color on mode change

This commit is contained in:
2019-03-09 01:15:23 +01:00
parent 3e54720e91
commit f0fed897f6
4 changed files with 10 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ void NodePanelQuick::init()
void NodePanelQuick::set_color(glm::vec3 color)
{
static_cast<NodeBorder*>(m_button_color_current->m_children[0].get())->m_color = glm::vec4(color, 1.f);
m_button_color_current_inner->m_color = glm::vec4(color, 1.f);
}
void NodePanelQuick::init_controls()
@@ -81,6 +81,7 @@ void NodePanelQuick::init_controls()
m_button_color3 = find<NodeButtonCustom>("quick-color3");
m_button_color_current = m_button_color1;
m_button_color_current->set_active(true);
m_button_color_current_inner = static_cast<NodeBorder*>(m_button_color_current->m_children[0].get());
m_button_color1->on_click = std::bind(&this_class::handle_button_color_click, this, std::placeholders::_1);
m_button_color2->on_click = std::bind(&this_class::handle_button_color_click, this, std::placeholders::_1);
m_button_color3->on_click = std::bind(&this_class::handle_button_color_click, this, std::placeholders::_1);
@@ -176,8 +177,9 @@ void NodePanelQuick::handle_button_color_click(Node* target)
button->set_active(true);
m_button_color_current->set_active(false);
m_button_color_current = button;
m_button_color_current_inner = static_cast<NodeBorder*>(m_button_color_current->m_children[0].get());
if (on_color_change)
on_color_change(this, static_cast<NodeBorder*>(button->m_children[0].get())->m_color);
on_color_change(this, m_button_color_current_inner->m_color);
return;
}