mirror of
https://github.com/Drezil/imgui.git
synced 2025-03-27 22:42:43 +00:00
Internal SliderFloatAsInputText() -> InputFloatReplaceWidget()
This commit is contained in:
parent
58ee08f214
commit
7650d4cc67
@ -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)
|
// 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;
|
ImGuiState& g = *GImGui;
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
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);
|
SetActiveId(id, window);
|
||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
|
|
||||||
const bool is_ctrl_down = g.IO.KeyCtrl;
|
if (tab_focus_requested || g.IO.KeyCtrl)
|
||||||
if (tab_focus_requested || is_ctrl_down)
|
|
||||||
{
|
{
|
||||||
start_text_input = true;
|
start_text_input = true;
|
||||||
g.ScalarAsInputTextId = 0;
|
g.ScalarAsInputTextId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))
|
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);
|
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))
|
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);
|
ItemSize(total_bb, style.FramePadding.y);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user