From 7650d4cc67ffb89565c96f60e2495240027c90eb Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 30 Jul 2015 22:59:30 -0600 Subject: [PATCH] Internal SliderFloatAsInputText() -> InputFloatReplaceWidget() --- imgui.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index def785569..661186001 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5876,7 +5876,7 @@ static void InputTextApplyArithmeticOp(const char* buf, float *v) } // Create text input in place of a slider (when CTRL+Clicking on slider) -static bool SliderFloatAsInputText(const ImRect& aabb, const char* label, float* v, ImGuiID id, int decimal_precision) +static bool InputFloatReplaceWidget(const ImRect& aabb, const char* label, float* v, ImGuiID id, int decimal_precision) { ImGuiState& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6118,15 +6118,14 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c SetActiveId(id, window); FocusWindow(window); - const bool is_ctrl_down = g.IO.KeyCtrl; - if (tab_focus_requested || is_ctrl_down) + if (tab_focus_requested || g.IO.KeyCtrl) { start_text_input = true; g.ScalarAsInputTextId = 0; } } if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) - return SliderFloatAsInputText(frame_bb, label, v, id, decimal_precision); + return InputFloatReplaceWidget(frame_bb, label, v, id, decimal_precision); ItemSize(total_bb, style.FramePadding.y); @@ -6429,7 +6428,7 @@ bool ImGui::DragFloat(const char* label, float *v, float v_speed, float v_min, f } } if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) - return SliderFloatAsInputText(frame_bb, label, v, id, decimal_precision); + return InputFloatReplaceWidget(frame_bb, label, v, id, decimal_precision); ItemSize(total_bb, style.FramePadding.y);