|
@ -1288,12 +1288,15 @@ void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* over |
|
|
if (!ItemAdd(bb, 0)) |
|
|
if (!ItemAdd(bb, 0)) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
// Render
|
|
|
// Out of courtesy we accept a NaN fraction without crashing
|
|
|
fraction = ImSaturate(fraction); |
|
|
fraction = ImSaturate(fraction); |
|
|
|
|
|
const float fraction_not_nan = (fraction == fraction) ? fraction : 0.0f; |
|
|
|
|
|
|
|
|
|
|
|
// Render
|
|
|
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); |
|
|
RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); |
|
|
bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize)); |
|
|
bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize)); |
|
|
const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y); |
|
|
const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction_not_nan), bb.Max.y); |
|
|
RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding); |
|
|
RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction_not_nan, style.FrameRounding); |
|
|
|
|
|
|
|
|
// Default displaying the fraction as percentage string, but user can override it
|
|
|
// Default displaying the fraction as percentage string, but user can override it
|
|
|
char overlay_buf[32]; |
|
|
char overlay_buf[32]; |
|
|