Popup presets panel, fix padding scissor, stacked mouse capture

This commit is contained in:
2019-01-26 00:55:57 +01:00
parent 79e4777f77
commit 14b26c8902
11 changed files with 184 additions and 66 deletions

View File

@@ -124,7 +124,7 @@ void App::init_sidebar()
color = find_or_create_panel<NodePanelColor>(panels);
stroke = find_or_create_panel<NodePanelStroke>(panels);
grid = find_or_create_panel<NodePanelGrid>(panels);
presets = find_or_create_panel<NodePanelBrushPreset>(panels);
//presets = find_or_create_panel<NodePanelBrushPreset>(panels);
// if (canvas)
// {
@@ -132,15 +132,15 @@ void App::init_sidebar()
// stroke->m_canvas->draw_stroke();
// }
presets->on_brush_changed = [this](Node* target, std::shared_ptr<Brush>& b) {
// don't change some params
b->m_tip_size = Canvas::I->m_current_brush->m_tip_size;
b->m_tip_color = Canvas::I->m_current_brush->m_tip_color;
*Canvas::I->m_current_brush = *b;
stroke->m_preview->draw_stroke();
stroke->m_brush_thumb->set_image(b->m_brush_thumb_path);
stroke->update_controls();
};
//presets->on_brush_changed = [this](Node* target, std::shared_ptr<Brush>& b) {
// // don't change some params
// b->m_tip_size = Canvas::I->m_current_brush->m_tip_size;
// b->m_tip_color = Canvas::I->m_current_brush->m_tip_color;
// *Canvas::I->m_current_brush = *b;
// stroke->m_preview->draw_stroke();
// stroke->m_brush_thumb->set_image(b->m_brush_thumb_path);
// stroke->update_controls();
//};
color->on_color_changed = [this](Node* target, glm::vec4 color) {
Canvas::I->m_current_brush->m_tip_color = color;
};
@@ -237,14 +237,14 @@ void App::init_sidebar()
// button->set_color(panels->get_child_index(brushes.get()) == -1 ? color_button_normal : color_button_hlight);
// };
//}
if (auto* button = layout[main_id]->find<NodeButton>("btn-brush-preset"))
{
button->on_click = [this, button](Node*) {
panels->get_child_index(presets.get()) == -1 ? panels->add_child(presets) : panels->remove_child(presets.get());
panels->fix_scroll();
button->set_color(panels->get_child_index(presets.get()) == -1 ? color_button_normal : color_button_hlight);
};
}
//if (auto* button = layout[main_id]->find<NodeButton>("btn-brush-preset"))
//{
// button->on_click = [this, button](Node*) {
// panels->get_child_index(presets.get()) == -1 ? panels->add_child(presets) : panels->remove_child(presets.get());
// panels->fix_scroll();
// button->set_color(panels->get_child_index(presets.get()) == -1 ? color_button_normal : color_button_hlight);
// };
//}
if (auto* button = layout[main_id]->find<NodeButtonCustom>("btn-color"))
{
button->on_click = [this, button](Node*) {