From 4b4f6d78ee2f79c11d1b68bc387898922ff0c179 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 5 Aug 2015 17:26:04 -0600 Subject: [PATCH] InputFloat() fixed 0 decimal_precision --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index b578f8a4..1e572123 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7735,7 +7735,7 @@ static bool InputScalarEx(const char* label, ImGuiDataType data_type, void* data bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags) { char display_format[16]; - if (decimal_precision) + if (decimal_precision < 0) strcpy(display_format, "%f"); // Ideally we'd have a minimum decimal precision of 1 to visually denote that this is a float, while hiding non-significant digits? %f doesn't have a minimum of 1 else ImFormatString(display_format, 16, "%%%df", decimal_precision);