Skip to content

implot context menu inside node editor #407

@Analysiszaj

Description

@Analysiszaj

Version/Branch:

latest

Back-ends:

glfw + openGL

Compiler, OS:

macOS + clang17

Details:

I downloaded the latest one imgui-bundle, I tried using the demo 'sandbox_plot_in_node.cpp' below, I found that when I right-click to open the pop-up box of the chart, it shows strange cropping, and sometimes a part is missing。

Minimal, Complete and Verifiable Example code:

Based on sandbox_plot_in_node.cpp

void gui()
{
    static ImVec2 plotSize(200, 200);
    static ImVec2 plotSize2(200, 200);
    static double xPos = 5.f;

    auto myPlotFunction = []()
    {
        static std::vector<float> x(1000), y(1000);
        for (int i = 0; i < 1000; ++i)
        {
            x[i] = i * 0.01f;
            y[i] = sin(x[i]);
        }
        ImPlot::PlotLine("My Line", x.data(), y.data(), 1000);
        ImPlot::DragLineX(0, &xPos, ImVec4(1, 1, 0, 1));
    };

    auto myPlotFunction2 = []()
    {
        static std::vector<float> x(1000), y(1000);
        for (int i = 0; i < 1000; ++i)
        {
            x[i] = i * 0.01f;
            y[i] = sin(x[i]);
        }
        ImPlot::PlotLine("My Line", x.data(), y.data(), 1000);
        ImPlot::DragLineX(0, &xPos, ImVec4(1, 1, 0, 1));
    };

    ed::Begin("My Node Editor");
    ed::BeginNode(ed::NodeId(1));
    ImGui::Text("Hello");
    ImGui::Text("World");
    plotSize = ImmApp::ShowResizablePlotInNodeEditor("My Plot", plotSize, myPlotFunction);
    ed::EndNode();

    ed::BeginNode(ed::NodeId(2));
    ImGui::Text("Hello");
    ImGui::Text("World");
    plotSize2 = ImmApp::ShowResizablePlotInNodeEditor("My Plot2", plotSize2, myPlotFunction2);
    ed::EndNode();

    ed::End();
}
PixPin_2025-10-29_13-37-09.mp4

Finally, Thank you for this amazing library!

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