reorder tool icons, add popup auto-hide after interaction

This commit is contained in:
2019-03-06 18:43:38 +01:00
parent 99929dac39
commit 5eba9f1227
8 changed files with 74 additions and 13 deletions

View File

@@ -31,6 +31,7 @@ void NodePanelColor::init_controls()
m_quad->m_color = hue_color;
if (on_color_changed)
on_color_changed(this, m_color);
m_interacted = true;
};
m_quad->on_value_changed = [this](Node*, glm::vec2 pos)
{
@@ -39,6 +40,7 @@ void NodePanelColor::init_controls()
m_color = glm::vec4(convert_hsv2rgb(glm::vec3(hue, m_cursor.x, 1.f-m_cursor.y)), 1.f);
if (on_color_changed)
on_color_changed(this, m_color);
m_interacted = true;
};
m_hue->set_value(0);
}
@@ -57,6 +59,10 @@ kEventResult NodePanelColor::handle_event(Event* e)
{
switch (e->m_type)
{
case kEventType::MouseLeave:
if (!m_interacted)
break;
// else fall through
case kEventType::MouseUpL:
if (!m_mouse_inside)
{
@@ -76,4 +82,5 @@ kEventResult NodePanelColor::handle_event(Event* e)
void NodePanelColor::added(Node* parent)
{
set_color(Canvas::I->m_current_brush->m_tip_color);
m_interacted = false;
}