-
Notifications
You must be signed in to change notification settings - Fork 631
Add custom right-click context menu #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Pass ImPlotFlags_NoCentralMenu to BeginPlot()
Usage BeginCustomContext(){ ...; EndCustomContext() } within BeginPlot()
|
I originally made this comment on the associated issue, but maybe it's better to put here.
|
|
Does 'assigned' mean I need to do... something? |
Huehuehe if I leave comments while reviewing you might want to do... something :) Actually, I don't think you can modify the code in this PR, right? Damn GitHub |
|
I'm trying to think on how to make the custom context menus more flexible. Right now, depending on where the user clicks (plot, axis, legend), a different context menu is shown. So I would suggest allowing the user specify which context menu they want to customize. Additionally, we should expose the if (ImPlot::BeginPlot("My Plot", ImVec2(-1, 0)))
{
// Plot things before
if (ImPlot::BeginPlotContextMenu())
{
if (ImGui::MenuItem("My Custom Item")) doThing();
ImGui::Separator();
ImPlot::ShowDefaultPlotContextMenu();
ImPlot::EndPlotContextMenu();
}
if (ImPlot::BeginAxisContextMenu(ImAxis_X1))
{
ImGui::Text("Overwritten X Axis Context Menu");
ImPlot::EndAxisContextMenu();
}
if (ImPlot::BeginLegendContextMenu())
{
ImGui::Text("My Legend Items:");
ImPlot::ShowDefaultLegendContextMenu();
ImPlot::EndLegendContextMenu();
}
ImPlot::EndPlot();
}I don't really love that it is a bit verbose, but it makes the behavior quite clear (hopefully). Let me know what you guys think! @moe93 @PapaNaxos |
|
I am of the opinion that having context menus appear based on what item is clicked is more practical. For instance, when plotting vibration data, I allow the users to choose whether to display the x-axis in RPMs, Hz, or seconds. Their biggest gripe was that they expected to find those choices when right-clicking the x-axis, and NOT within the custom context menu found by right-clicking the plot area. |
|
That's a far better interface I think! |
Closes #530
Usage:
This is the work of @PapaNaxos. I just packaged it and created the PR.