Added ImGui::GetItemActiveDragDelta() helpers for drag operations

This commit is contained in:
ocornut
2015-03-18 10:41:46 +00:00
parent 215b0065e3
commit e10d648a28
2 changed files with 15 additions and 3 deletions

View File

@ -2551,6 +2551,17 @@ bool ImGui::IsAnyItemActive()
return g.ActiveId != 0;
}
ImVec2 ImGui::GetItemActiveDragDelta()
{
if (ImGui::IsItemActive())
{
ImGuiState& g = *GImGui;
if (g.IO.MouseDown[0])
return g.IO.MousePos - g.IO.MouseClickedPos[0]; // Assume we can only get active with left-mouse button (at the moment).
}
return ImVec2(0.0f, 0.0f);
}
ImVec2 ImGui::GetItemRectMin()
{
ImGuiWindow* window = GetCurrentWindow();