Narrow retained UI overlay lifetime debt

This commit is contained in:
2026-06-15 19:26:11 +02:00
parent f907d88c26
commit 565564c061
15 changed files with 603 additions and 67 deletions

View File

@@ -174,7 +174,15 @@ kEventResult NodePanelBrush::handle_event(Event* e)
case kEventType::MouseUpL:
if (!m_mouse_inside)
{
pp::panopainter::close_legacy_popup_panel(*this, on_popup_close);
pp::panopainter::release_legacy_mouse_capture(*this);
if (m_parent)
{
pp::panopainter::detach_legacy_node_from_parent(*this);
}
if (on_popup_close)
{
on_popup_close(this);
}
}
break;
default:
@@ -580,11 +588,15 @@ void NodePanelBrushPreset::init()
if (!popup)
return;
popup->SetPosition(b->m_pos.x + b->m_size.x, b->m_pos.y);
(void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, popup);
const auto popup_overlay = pp::panopainter::open_legacy_overlay_node_with_handle(*this, popup);
if (!popup_overlay) {
return;
}
const auto popup_handle = popup_overlay.value();
root()->update();
auto bounds = root()->GetSize() - zw(popup->get_children_rect());
popup->SetPosition(glm::clamp(popup->m_pos, { 0, 0 }, bounds));
popup->on_select = [this, popup] (Node* target, int index) {
popup->on_select = [this, popup_handle](Node* target, int index) {
switch (index)
{
case 0: // import file
@@ -620,7 +632,7 @@ void NodePanelBrushPreset::init()
break;
}
}
pp::panopainter::close_legacy_popup_overlay(*popup);
(void)pp::panopainter::close_legacy_overlay_node(*this, popup_handle);
};
};
m_btn_import = find<NodeButton>("import");
@@ -665,7 +677,15 @@ kEventResult NodePanelBrushPreset::handle_event(Event* e)
case kEventType::MouseUpL:
if (!m_mouse_inside)
{
pp::panopainter::close_legacy_popup_panel(*this, on_popup_close);
pp::panopainter::release_legacy_mouse_capture(*this);
if (m_parent)
{
pp::panopainter::detach_legacy_node_from_parent(*this);
}
if (on_popup_close)
{
on_popup_close(this);
}
}
break;
default: