implot context menu inside node editor
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();
}
https://github.com/user-attachments/assets/99f0ce89-2150-4809-a29e-4bafea58cbd3
Finally, Thank you for this amazing library!
Hello,
This issue is due to imgui-node-editor: popups may cause issue inside the node editor (and the context menu is rendered inside a popup).
See related imgui-node-editor issue: https://github.com/thedmd/imgui-node-editor/issues/242
ImGui Bundle addresses most of the issues by applying patches described in this issue, however this particular render issue is not easy to solve.