1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-28 09:30:56 +01:00

Slider code syntax tweaks

This commit is contained in:
ocornut 2015-03-14 09:36:15 +00:00
parent eff466d77d
commit 72855becab

View File

@ -4827,9 +4827,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
// Process clicking on the slider
if (g.ActiveId == id)
{
if (g.IO.MouseDown[0])
{
if (!is_unbound)
if (!is_unbound && g.IO.MouseDown[0])
{
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;
}
}
}
else
{
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));
}
// 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_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);