mirror of https://github.com/ocornut/imgui
SliderAngle: Added optional `format` argument to allow users customize precision and make localization. (#2150)
This commit is contained in:
parent
12c72d2893
commit
faecf90383
|
@ -50,6 +50,7 @@ Other Changes:
|
|||
erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075).
|
||||
- DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024)
|
||||
- DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024)
|
||||
- SliderAngle: Added optional format argument to alter precision or localize the string. (#2150) [@podsvirov]
|
||||
- Window: Resizing from edges (with io.ConfigResizeWindowsFromEdges Beta flag) extends the hit region
|
||||
of root floating windows outside the window, making it easier to resize windows. Resize grips are also
|
||||
extended accordingly so there are no discontinuity when hovering between borders and corners. (#1495, #822)
|
||||
|
|
2
imgui.h
2
imgui.h
|
@ -380,7 +380,7 @@ namespace ImGui
|
|||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
|
||||
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg");
|
||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d");
|
||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d");
|
||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d");
|
||||
|
|
|
@ -2391,10 +2391,12 @@ bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max
|
|||
return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max)
|
||||
bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max, const char* format)
|
||||
{
|
||||
if (format == NULL)
|
||||
format = "%.0f deg";
|
||||
float v_deg = (*v_rad) * 360.0f / (2*IM_PI);
|
||||
bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, "%.0f deg", 1.0f);
|
||||
bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, format, 1.0f);
|
||||
*v_rad = v_deg * (2*IM_PI) / 360.0f;
|
||||
return value_changed;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue