mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Internal: Added IsMouseDragPastThreshold(). Tweaks. Todo.
Demo: Showing how to use the format parameter of Slider/Drag functions to display the name of an enum value instead of the underlying integer value
This commit is contained in:
17
imgui.cpp
17
imgui.cpp
@ -4433,15 +4433,23 @@ bool ImGui::IsMouseDoubleClicked(int button)
|
||||
return g.IO.MouseDoubleClicked[button];
|
||||
}
|
||||
|
||||
// [Internal] This doesn't test if the button is presed
|
||||
bool ImGui::IsMouseDragPastThreshold(int button, float lock_threshold)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
if (lock_threshold < 0.0f)
|
||||
lock_threshold = g.IO.MouseDragThreshold;
|
||||
return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
|
||||
}
|
||||
|
||||
bool ImGui::IsMouseDragging(int button, float lock_threshold)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));
|
||||
if (!g.IO.MouseDown[button])
|
||||
return false;
|
||||
if (lock_threshold < 0.0f)
|
||||
lock_threshold = g.IO.MouseDragThreshold;
|
||||
return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;
|
||||
return IsMouseDragPastThreshold(button, lock_threshold);
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetMousePos()
|
||||
@ -9719,6 +9727,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
if (!node_open)
|
||||
return;
|
||||
|
||||
if (window && !window->WasActive)
|
||||
ImGui::Text("(Note: owning Window is inactive: DrawList is not being rendered!)");
|
||||
|
||||
int elem_offset = 0;
|
||||
for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.begin(); pcmd < draw_list->CmdBuffer.end(); elem_offset += pcmd->ElemCount, pcmd++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user