DragFloat, DragInt: Default format string is none is passed to the function. Fixed demo using old style %.0f.

This commit is contained in:
omar
2018-05-04 15:29:33 +02:00
parent f47c756755
commit dcd26f1295
2 changed files with 8 additions and 5 deletions

View File

@ -9321,8 +9321,11 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, floa
}
const bool hovered = ItemHoverable(frame_bb, id);
// Default format string when passing NULL
// Patch old "%.0f" format string to use "%d", read function comments for more details.
if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0)
if (format == NULL)
format = GDataTypeInfo[data_type].PrintFmt;
else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0)
format = PatchFormatStringFloatToInt(format);
// Tabbing or CTRL-clicking on Drag turns it into an input box