add scrollbar, improve presets, other small fixes

This commit is contained in:
2019-01-27 17:19:06 +01:00
parent 6f3465392b
commit 99c06803ae
14 changed files with 94 additions and 20 deletions

View File

@@ -193,13 +193,33 @@ void NodePanelBrushPreset::init()
brush->thumb_path = Canvas::I->m_current_brush->m_brush_thumb_path;
brush->high_path = Canvas::I->m_current_brush->m_brush_path;
brush->m_brush = std::make_shared<Brush>(*Canvas::I->m_current_brush);
brush->m_brush->m_tip_size = .05f;
//brush->m_brush->m_tip_size = .05f;
brush->m_preview->m_brush = brush->m_brush;
brush->m_preview->draw_stroke();
brush->m_thumb->set_image(brush->m_brush->m_brush_thumb_path);
brush->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
save();
};
m_btn_up = find<NodeButtonCustom>("btn-up");
m_btn_up->on_click = [this](Node*) {
if (m_current)
m_container->move_child(m_current, std::max(m_container->get_child_index(m_current) - 1, 0));
};
m_btn_down = find<NodeButtonCustom>("btn-down");
m_btn_down->on_click = [this](Node*) {
if (m_current)
m_container->move_child(m_current,
std::min(m_container->get_child_index(m_current) + 1, (int)m_container->m_children.size() - 1));
};
m_btn_save = find<NodeButtonCustom>("btn-save");
m_btn_save->on_click = [this](Node*) {
if (m_current)
{
*m_current->m_brush = *Canvas::I->m_current_brush;
m_current->m_preview->draw_stroke();
m_current->m_thumb->set_image(m_current->m_brush->m_brush_thumb_path);
}
};
m_btn_delete = find<NodeButtonCustom>("btn-remove");
m_btn_delete->on_click = [this](Node*) {
if (!m_current)