Internals: Exposed NavScoreItemGetQuadrant() as ImGetDirQuadrantFromDelta() in imgui_internal.h

This commit is contained in:
omar 2018-07-18 16:16:44 +02:00
parent 049c515840
commit f22024cb19
2 changed files with 4 additions and 3 deletions

View File

@ -2378,7 +2378,7 @@ void ImGui::ItemSize(const ImRect& bb, float text_offset_y)
ItemSize(bb.GetSize(), text_offset_y);
}
static ImGuiDir inline NavScoreItemGetQuadrant(float dx, float dy)
ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy)
{
if (ImFabs(dx) > ImFabs(dy))
return (dx > 0.0f) ? ImGuiDir_Right : ImGuiDir_Left;
@ -2454,7 +2454,7 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
dax = dbx;
day = dby;
dist_axial = dist_box;
quadrant = NavScoreItemGetQuadrant(dbx, dby);
quadrant = ImGetDirQuadrantFromDelta(dbx, dby);
}
else if (dcx != 0.0f || dcy != 0.0f)
{
@ -2462,7 +2462,7 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
dax = dcx;
day = dcy;
dist_axial = dist_center;
quadrant = NavScoreItemGetQuadrant(dcx, dcy);
quadrant = ImGetDirQuadrantFromDelta(dcx, dcy);
}
else
{

View File

@ -127,6 +127,7 @@ IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, con
IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);
IMGUI_API void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w);
IMGUI_API ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy);
// Helpers: String
IMGUI_API int ImStricmp(const char* str1, const char* str2);