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

docking
ocornut 10 years ago
parent a71fc8e6a5
commit 2d29907611

@ -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();

@ -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);

Loading…
Cancel
Save