From f5dbb0a97340b3b342c7fbc6b543bbf00b155b32 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 15 Aug 2014 17:54:42 +0100 Subject: [PATCH] Fixed floating-point precision issue making the right-side value of a plot sometimes wrap to the left-side value. --- imgui.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 63dddcc4..449580e3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -131,7 +131,6 @@ - combo: turn child handling code into popup helper - list selection, concept of a selectable "block" (that can be multiple widgets) - menubar, menus - - plot: plot lines draws 1 item too much? - plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID) - file selection widget -> build the tool in our codebase to improve model-dialog idioms (may or not lead to ImGui changes) - slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt() @@ -3400,7 +3399,7 @@ static void Plot(ImGuiPlotType plot_type, const char* label, const float* values const ImU32 col_base = window->Color((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram); const ImU32 col_hovered = window->Color((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered); - while (t0 < 1.0f) + for (int n = 0; n < res_w; n++) { const float t1 = t0 + t_step; const int v_idx = (int)(t0 * values_count);