Thin app dialog export and popup seams
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "node_panel_floating.h"
|
||||
#include "app_core/brush_ui.h"
|
||||
#include "app_core/document_layer.h"
|
||||
#include "legacy_sidebar_grid_popup_services.h"
|
||||
#include "legacy_sidebar_color_popup_services.h"
|
||||
#include "legacy_sidebar_stroke_popup_services.h"
|
||||
#include "legacy_brush_ui_services.h"
|
||||
@@ -321,49 +322,7 @@ void App::init_sidebar()
|
||||
if (!popup_root) {
|
||||
return;
|
||||
}
|
||||
auto screen = popup_root->m_size;
|
||||
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
||||
grid->find("title")->SetVisibility(true);
|
||||
grid->SetSize(350, YGUndefined);
|
||||
if (grid->m_parent)
|
||||
{
|
||||
if (auto fp = dynamic_cast<NodePanelFloating*>(grid->m_parent->m_parent))
|
||||
{
|
||||
pp::panopainter::detach_legacy_node_from_parent(*grid);
|
||||
pp::panopainter::close_legacy_dialog_node(*fp);
|
||||
}
|
||||
}
|
||||
const auto popup_overlay = pp::panopainter::open_legacy_overlay_node_with_handle(*popup_root, grid);
|
||||
if (!popup_overlay)
|
||||
{
|
||||
LOG("Grid popup overlay failed: %s", popup_overlay.status().message);
|
||||
return;
|
||||
}
|
||||
auto tick = pp::panopainter::make_legacy_overlay_node_for_anchor<NodeImage>(*popup_root);
|
||||
tick->SetPositioning(YGPositionTypeAbsolute);
|
||||
tick->SetSize(32, 16);
|
||||
tick->SetPosition(pos.x - 16, pos.y);
|
||||
tick->set_image("data/ui/popup-tick-up.png");
|
||||
auto tick_overlay = pp::panopainter::open_legacy_overlay_node_with_handle(*popup_root, tick);
|
||||
if (!popup_overlay || !tick_overlay)
|
||||
{
|
||||
close_legacy_overlay_handles_if_open(*popup_root, popup_overlay, tick_overlay);
|
||||
return;
|
||||
}
|
||||
const auto popup_handle = popup_overlay.value();
|
||||
const auto tick_handle = tick_overlay.value();
|
||||
popup_root->update();
|
||||
|
||||
grid->SetPosition(pos.x - grid->m_size.x / 2.f, pos.y + 16);
|
||||
grid->SetPositioning(YGPositionTypeAbsolute);
|
||||
pp::panopainter::activate_legacy_popup_overlay(*grid);
|
||||
auto scroll = grid->find<NodeScroll>("scroller");
|
||||
scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 250.f));
|
||||
|
||||
grid->on_popup_close = [popup_root, popup_handle, tick_handle](Node*) {
|
||||
close_legacy_overlay_handle_ignoring_status(*popup_root, popup_handle);
|
||||
close_legacy_overlay_handle_ignoring_status(*popup_root, tick_handle);
|
||||
};
|
||||
pp::panopainter::open_legacy_sidebar_grid_popup(*popup_root, *button, *grid);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user