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

@@ -191,6 +191,10 @@ kEventResult NodePanelBrush::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)
{
@@ -217,6 +221,7 @@ void NodePanelBrush::handle_click(Node* target)
m_current->m_selected = true;
if (on_brush_changed)
on_brush_changed(this, m_container->get_child_index(target));
m_interacted = true;
}
int NodePanelBrush::find_brush(const std::string & name) const
@@ -330,6 +335,11 @@ bool NodePanelBrush::restore()
return false;
}
void NodePanelBrush::added(Node* parent)
{
m_interacted = false;
}
// -----------------------------------------------------------------------
Node* NodeBrushPresetItem::clone_instantiate() const
@@ -426,6 +436,10 @@ kEventResult NodePanelBrushPreset::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)
{
@@ -452,6 +466,7 @@ void NodePanelBrushPreset::handle_click(Node* target)
m_current->m_selected = true;
if (on_brush_changed)
on_brush_changed(this, m_current->m_brush);
m_interacted = true;
}
bool NodePanelBrushPreset::save()
@@ -704,3 +719,8 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr<Brush> brush)
b->m_caption_size->set_text_format("%d", (int)brush->m_tip_size);
b->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
}
void NodePanelBrushPreset::added(Node* parent)
{
m_interacted = false;
}