mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Slider code syntax tweaks
This commit is contained in:
parent
eff466d77d
commit
72855becab
@ -4827,9 +4827,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
|||||||
// Process clicking on the slider
|
// Process clicking on the slider
|
||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id)
|
||||||
{
|
{
|
||||||
if (g.IO.MouseDown[0])
|
if (!is_unbound && g.IO.MouseDown[0])
|
||||||
{
|
|
||||||
if (!is_unbound)
|
|
||||||
{
|
{
|
||||||
const float normalized_pos = ImClamp((g.IO.MousePos.x - slider_effective_x1) / slider_effective_w, 0.0f, 1.0f);
|
const float normalized_pos = ImClamp((g.IO.MousePos.x - slider_effective_x1) / slider_effective_w, 0.0f, 1.0f);
|
||||||
|
|
||||||
@ -4878,7 +4876,6 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
|||||||
value_changed = true;
|
value_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetActiveId(0);
|
SetActiveId(0);
|
||||||
@ -4915,7 +4912,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
|||||||
window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, window->Color(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab));
|
window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, window->Color(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
||||||
char value_buf[64];
|
char value_buf[64];
|
||||||
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
||||||
const ImVec2 value_text_size = CalcTextSize(value_buf, value_buf_end, true);
|
const ImVec2 value_text_size = CalcTextSize(value_buf, value_buf_end, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user