mirror of
https://github.com/Drezil/imgui.git
synced 2025-04-15 23:54:01 +00:00
Fixed parsing of decimal precision back from format string when using %%
This commit is contained in:
parent
110d96034b
commit
eff466d77d
@ -4735,9 +4735,10 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
|||||||
|
|
||||||
// Parse display precision back from the display format string
|
// Parse display precision back from the display format string
|
||||||
int decimal_precision = 3;
|
int decimal_precision = 3;
|
||||||
if (const char* p = strchr(display_format, '%'))
|
for (const char* p = display_format; p = strchr(p, '%'); )
|
||||||
{
|
{
|
||||||
p++;
|
p++;
|
||||||
|
if (p[0] == '%') { p ++; continue; } // Ignore "%%"
|
||||||
while (*p >= '0' && *p <= '9')
|
while (*p >= '0' && *p <= '9')
|
||||||
p++;
|
p++;
|
||||||
if (*p == '.')
|
if (*p == '.')
|
||||||
@ -4746,6 +4747,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
|||||||
if (decimal_precision < 0 || decimal_precision > 10)
|
if (decimal_precision < 0 || decimal_precision > 10)
|
||||||
decimal_precision = 3;
|
decimal_precision = 3;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
const ImVec2 label_size = CalcTextSize(label, NULL, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user