Skip to content

Node with title bar gets expanded infinitely #209

Description

@tim-tim707

I'm trying to make the default examples work. Here is my main loop:

void main_loop(App &app) {
    ImGui::Begin("node editor");
    ImNodes::BeginNodeEditor();

    const int hardcoded_node_id = 1;

    ImNodes::BeginNode(hardcoded_node_id + 1);

    ImNodes::BeginNodeTitleBar();
    ImGui::TextUnformatted("node");
    ImNodes::EndNodeTitleBar();

    ImNodes::EndNode();

    ImNodes::EndNodeEditor();
    ImGui::End();
}
// Elsewhere:
    while (glfwWindowShouldClose(window) != GLFW_TRUE) {
        glfwPollEvents();
        ImGui_ImplOpenGL3_NewFrame();
        ImGui_ImplGlfw_NewFrame();
        ImGui::NewFrame();

        main_loop(app);

        ImGui::Render();
        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

        glfwSwapBuffers(window);
    }

For some reason, the node rectangle gets expanded every loop by the padding value at

ImNodes::EndNode(); -> node.Rect.Expand(node.LayoutStyle.Padding); -> Rect gets 8 pixel added to Max.x every loop (but not Max.y)

I don't really understand why it is doing this. Should I create a context and destroy it every frame ? I'm not doing it for ImGui and the examples do not seem to do it as well.

ImGui version 1.19.1
imnodes from branch master commit b2ec254

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions