open presets from the brush preview, fix scrollbar redraw

This commit is contained in:
2019-02-28 12:10:03 +01:00
parent a961630eb4
commit e59dd66b46
4 changed files with 11 additions and 12 deletions

View File

@@ -252,7 +252,7 @@ void NodePanelStroke::init_controls()
m_presets_popup->create();
m_presets_popup->loaded();
m_presets_popup->SetPositioning(YGPositionTypeAbsolute);
m_presets_popup->SetSize(300, 400);
m_presets_popup->SetSize(YGUndefined, 400);
m_presets_popup->m_mouse_ignore = false;
m_presets_popup->m_flood_events = true;
m_presets_popup->m_capture_children = false;
@@ -272,7 +272,7 @@ void NodePanelStroke::init_controls()
// BRUSH PRESETS
m_preset_button = find<NodeButton>("preset-button");
m_preset_button = find<NodeButtonCustom>("preset-button");
m_preset_button->on_click = [this](Node*) {
auto screen = root()->m_size;
glm::vec2 pos = m_preset_button->m_pos + glm::vec2(m_preset_button->m_size.x, 0);
@@ -283,7 +283,7 @@ void NodePanelStroke::init_controls()
tick->SetPosition(pos.x, pos.y + (m_preset_button->m_size.y - 32) * 0.5f);
tick->set_image("data/ui/popup-tick.png");
float hh = m_presets_popup->m_container->m_children.size() > 10 ? App::I.height / App::I.zoom * .75f : 400.f;
m_presets_popup->SetSize(300, glm::max(hh, 400.f));
m_presets_popup->SetHeight(glm::max(hh, 400.f));
root()->update();
if ((pos.y + m_presets_popup->m_size.y) > screen.y)
pos.y = screen.y - m_presets_popup->m_size.y;