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

Added GetMouseDragDelta() helper. No unlock threshold yet (#167)

This commit is contained in:
ocornut 2015-03-20 10:49:17 +00:00
parent a71fc8e6a5
commit 2d29907611
2 changed files with 9 additions and 0 deletions

View File

@ -2541,6 +2541,14 @@ ImVec2 ImGui::GetMousePos()
return GImGui->IO.MousePos;
}
ImVec2 ImGui::GetMouseDragDelta()
{
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);
}
bool ImGui::IsItemHovered()
{
ImGuiWindow* window = GetCurrentWindow();

View File

@ -371,6 +371,7 @@ namespace ImGui
IMGUI_API bool IsMouseHoveringRect(const ImVec2& rect_min, const ImVec2& rect_max);// is mouse hovering given bounding rect
IMGUI_API bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
IMGUI_API ImVec2 GetMouseDragDelta(); // dragging amount - also see: GetItemActiveDragDelta().
IMGUI_API float GetTime();
IMGUI_API int GetFrameCount();
IMGUI_API const char* GetStyleColName(ImGuiCol idx);