Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
1.94k stars 237 forks source link

Popup over Grid/Node? #185

Open xahon opened 1 year ago

xahon commented 1 year ago

Popup doesn't show up with example imgui code

ImNodes::BeginNodeEditor(); // Or ImNodes::BeginNode(hardcoded_node_id);
// Below ImGui's demo code
if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id
{
    selected = n;
    ImGui::Text("This a popup for \"%s\"!", names[n]);
    if (ImGui::Button("Close"))
        ImGui::CloseCurrentPopup();
    ImGui::EndPopup();
}

I'm trying to bring in a context menu for convenient nodes creation

kieroooo commented 1 year ago

I think i had the same issue and solved it by moving the popup handling outside of the NodeEditor's Begin/End block. In node editor i only remember which node the popup would be related to.