mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-17 21:56:36 +00:00
Added ImGui::GetItemActiveDragDelta() helpers for drag operations
This commit is contained in:
parent
215b0065e3
commit
e10d648a28
11
imgui.cpp
11
imgui.cpp
@ -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();
|
||||
|
7
imgui.h
7
imgui.h
@ -354,12 +354,13 @@ namespace ImGui
|
||||
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse?
|
||||
IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
||||
IMGUI_API bool IsAnyItemActive(); //
|
||||
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
||||
IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
||||
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
||||
IMGUI_API ImVec2 GetItemActiveDragDelta(); // mouse delta from the time the item first got active
|
||||
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item
|
||||
IMGUI_API ImVec2 GetItemRectMax(); // "
|
||||
IMGUI_API ImVec2 GetItemRectSize(); // "
|
||||
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
||||
IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
||||
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
||||
IMGUI_API bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimization)
|
||||
IMGUI_API bool IsKeyPressed(int key_index, bool repeat = true); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
|
||||
IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
||||
|
Loading…
Reference in New Issue
Block a user