Centralize retained panel popup attachment

This commit is contained in:
2026-06-06 10:46:29 +02:00
parent 5ff2992c0e
commit ab36af0a8f
9 changed files with 49 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
#include "assets/brush_package.h"
#include "app_core/brush_ui.h"
#include "legacy_brush_ui_services.h"
#include "legacy_ui_overlay_services.h"
#include "asset.h"
#include "texture.h"
@@ -579,7 +580,7 @@ void NodePanelBrushPreset::init()
m_btn_menu->on_click = [this](Node* b) {
auto popup = add_child_file<NodePopupMenu>("data/dialogs/panel-brushes.xml", "tpl-brush-popup");
popup->SetPosition(b->m_pos.x + b->m_size.x, b->m_pos.y);
root()->add_child(popup);
(void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, popup);
root()->update();
auto bounds = root()->GetSize() - zw(popup->get_children_rect());
popup->SetPosition(glm::clamp(popup->m_pos, { 0, 0 }, bounds));