1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-23 02:38:53 -05:00

Fix for changes in imgui master + fix misuse of ImGui::Value() (#186)

This commit is contained in:
omar 2021-03-16 12:37:45 +01:00 committed by GitHub
parent 46ea9abab4
commit b85a2c0800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -76,6 +76,11 @@ You can read releases logs https://github.com/epezent/implot/releases for more d
#define sprintf sprintf_s #define sprintf sprintf_s
#endif #endif
// Support for pre-1.82 version. Users on 1.82+ can use 0 (default) flags to mean "all corners" but in order to support older versions we are more explicit.
#if (IMGUI_VERSION_NUM < 18102) && !defined(ImDrawFlags_RoundCornersAll)
#define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All
#endif
// Global plot context // Global plot context
ImPlotContext* GImPlot = NULL; ImPlotContext* GImPlot = NULL;
@ -2426,7 +2431,7 @@ void EndPlot() {
// render border // render border
if (gp.Style.PlotBorderSize > 0) if (gp.Style.PlotBorderSize > 0)
DrawList.AddRect(plot.PlotRect.Min, plot.PlotRect.Max, GetStyleColorU32(ImPlotCol_PlotBorder), 0, ImDrawCornerFlags_All, gp.Style.PlotBorderSize); DrawList.AddRect(plot.PlotRect.Min, plot.PlotRect.Max, GetStyleColorU32(ImPlotCol_PlotBorder), 0, ImDrawFlags_RoundCornersAll, gp.Style.PlotBorderSize);
// FIT DATA -------------------------------------------------------------- // FIT DATA --------------------------------------------------------------
const bool axis_equal = ImHasFlag(plot.Flags, ImPlotFlags_Equal); const bool axis_equal = ImHasFlag(plot.Flags, ImPlotFlags_Equal);
@ -3902,7 +3907,7 @@ void ShowMetricsWindow(bool* p_popen) {
ImGui::Bullet(); ImGui::ColorEdit4("Color",&item->Color.x, ImGuiColorEditFlags_NoInputs); ImGui::Bullet(); ImGui::ColorEdit4("Color",&item->Color.x, ImGuiColorEditFlags_NoInputs);
ImGui::Bullet(); ImGui::Text("NameOffset: %d",item->NameOffset); ImGui::Bullet(); ImGui::Text("NameOffset: %d",item->NameOffset);
ImGui::Bullet(); ImGui::Text("Name: %s", item->NameOffset != -1 ? plot->LegendData.Labels.Buf.Data + item->NameOffset : "N/A"); ImGui::Bullet(); ImGui::Text("Name: %s", item->NameOffset != -1 ? plot->LegendData.Labels.Buf.Data + item->NameOffset : "N/A");
ImGui::Bullet(); ImGui::Value("Hovered: %s",item->LegendHovered ? "true" : "false"); ImGui::Bullet(); ImGui::Text("Hovered: %s", item->LegendHovered ? "true" : "false");
ImGui::TreePop(); ImGui::TreePop();
} }
ImGui::PopID(); ImGui::PopID();

View File

@ -42,6 +42,11 @@
} \ } \
} }
// Support for pre-1.82 version. Users on 1.82+ can use 0 (default) flags to mean "all corners" but in order to support older versions we are more explicit.
#if (IMGUI_VERSION_NUM < 18102) && !defined(ImDrawFlags_RoundCornersAll)
#define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All
#endif
namespace ImPlot { namespace ImPlot {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -1277,7 +1282,7 @@ void PlotBarsEx(const char* label_id, const Getter& getter, double width) {
if (s.RenderFill) if (s.RenderFill)
DrawList.AddRectFilled(a, b, col_fill); DrawList.AddRectFilled(a, b, col_fill);
if (rend_line) if (rend_line)
DrawList.AddRect(a, b, col_line, 0, ImDrawCornerFlags_All, s.LineWeight); DrawList.AddRect(a, b, col_line, 0, ImDrawFlags_RoundCornersAll, s.LineWeight);
} }
EndItem(); EndItem();
} }
@ -1356,7 +1361,7 @@ void PlotBarsHEx(const char* label_id, const Getter& getter, THeight height) {
if (s.RenderFill) if (s.RenderFill)
DrawList.AddRectFilled(a, b, col_fill); DrawList.AddRectFilled(a, b, col_fill);
if (rend_line) if (rend_line)
DrawList.AddRect(a, b, col_line, 0, ImDrawCornerFlags_All, s.LineWeight); DrawList.AddRect(a, b, col_line, 0, ImDrawFlags_RoundCornersAll, s.LineWeight);
} }
EndItem(); EndItem();
} }