implement tip popup tip selection and change default brush color to black

This commit is contained in:
2019-01-16 16:10:19 +01:00
parent 3d7b7107d4
commit 7eac018ae4
8 changed files with 105 additions and 25 deletions

View File

@@ -98,6 +98,35 @@ void NodePanelStroke::init_controls()
}
});
};
m_brush_popup = std::make_shared<NodePanelBrush>();
m_brush_popup->m_manager = m_manager;
m_brush_popup->init();
m_brush_popup->create();
m_brush_popup->loaded();
m_brush_popup->SetPositioning(YGPositionTypeAbsolute);
m_brush_popup->SetSize(400, 400);
m_brush_popup->m_mouse_ignore = false;
m_brush_popup->m_flood_events = true;
m_brush_popup->m_capture_children = false;
m_brush_thumb = find<NodeImage>("tip-change-thumb");
m_brush_button = find<NodeButtonCustom>("tip-change");
m_brush_button->on_click = [this](Node*) {
glm::vec2 pos = m_brush_button->m_pos + glm::vec2(m_brush_button->m_size.x, 0);
root()->add_child(m_brush_popup);
m_brush_popup->SetPosition(pos.x, pos.y);
m_brush_popup->mouse_capture();
root()->update();
m_brush_popup->on_brush_changed = [this](Node*, int index) {
if (on_brush_changed)
on_brush_changed(this, m_brush_popup->get_brush_id(index), m_brush_popup->get_texture_id(index));
m_brush_thumb->set_image(m_brush_popup->get_thumb_path(index));
m_brush_popup->mouse_release();
m_brush_popup->parent->remove_child(m_brush_popup.get());
};
};
}
void NodePanelStroke::init_slider(NodeSliderH*& target, const char* id, float Brush::* prop)