hide cursor on canvas, add mouse focus event, brush preview solid when small

This commit is contained in:
2019-03-06 20:39:27 +01:00
parent 5eba9f1227
commit 3296de98cc
15 changed files with 194 additions and 24 deletions

View File

@@ -41,18 +41,36 @@ void NodePanelQuick::init_controls()
m_slider_size = find<NodeSliderV>("quick-size");
m_slider_size->on_value_changed = [this](Node* target, float value) {
auto m = static_cast<CanvasModePen*>(Canvas::I->modes[(int)kCanvasMode::Draw][0]);
m->m_cur_pos = (m_slider_flow->m_pos + glm::vec2(100.f, m_slider_flow->m_size.y / 2.f)) * App::I.zoom;
m->m_draw_tip = true;
auto newpos = (m_slider_flow->m_pos + glm::vec2(100.f, m_slider_flow->m_size.y / 2.f)) * App::I.zoom;
if (auto m = dynamic_cast<CanvasModePen*>(Canvas::I->modes[(int)Canvas::I->m_current_mode][0]))
{
m->m_cur_pos = newpos;
m->m_draw_tip = true;
m->m_draw_outline = false;
}
if (auto m = dynamic_cast<CanvasModeLine*>(Canvas::I->modes[(int)Canvas::I->m_current_mode][0]))
{
m->m_cur_pos = newpos;
m->m_draw_tip = true;
}
m_button_brush_current_preview->draw_stroke();
if (on_size_change)
on_size_change(target, value);
};
m_slider_flow = find<NodeSliderV>("quick-flow");
m_slider_flow->on_value_changed = [this](Node* target, float value) {
auto m = static_cast<CanvasModePen*>(Canvas::I->modes[(int)kCanvasMode::Draw][0]);
m->m_cur_pos = (m_slider_flow->m_pos + glm::vec2(100.f, m_slider_flow->m_size.y / 2.f)) * App::I.zoom;
m->m_draw_tip = true;
auto newpos = (m_slider_flow->m_pos + glm::vec2(100.f, m_slider_flow->m_size.y / 2.f)) * App::I.zoom;
if (auto m = dynamic_cast<CanvasModePen*>(Canvas::I->modes[(int)Canvas::I->m_current_mode][0]))
{
m->m_cur_pos = newpos;
m->m_draw_tip = true;
m->m_draw_outline = false;
}
if (auto m = dynamic_cast<CanvasModeLine*>(Canvas::I->modes[(int)Canvas::I->m_current_mode][0]))
{
m->m_cur_pos = newpos;
m->m_draw_tip = true;
}
m_button_brush_current_preview->draw_stroke();
if (on_flow_change)
on_flow_change(target, value);