mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
InputFloat() fixed 0 decimal_precision
This commit is contained in:
parent
a54995eace
commit
4b4f6d78ee
@ -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)
|
bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags)
|
||||||
{
|
{
|
||||||
char display_format[16];
|
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
|
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
|
else
|
||||||
ImFormatString(display_format, 16, "%%%df", decimal_precision);
|
ImFormatString(display_format, 16, "%%%df", decimal_precision);
|
||||||
|
Loading…
Reference in New Issue
Block a user