mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-18 01:14:19 +00:00
Merge branch 'master' into examples_refactor
This commit is contained in:
commit
e6bc840f6f
14 changed files with 1511 additions and 45 deletions
11
imgui.cpp
11
imgui.cpp
|
|
@ -951,14 +951,13 @@ ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p)
|
|||
{
|
||||
ImVec2 ap = p - a;
|
||||
ImVec2 ab_dir = b - a;
|
||||
float ab_len = sqrtf(ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y);
|
||||
ab_dir *= 1.0f / ab_len;
|
||||
float dot = ap.x * ab_dir.x + ap.y * ab_dir.y;
|
||||
if (dot < 0.0f)
|
||||
return a;
|
||||
if (dot > ab_len)
|
||||
float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y;
|
||||
if (dot > ab_len_sqr)
|
||||
return b;
|
||||
return a + ab_dir * dot;
|
||||
return a + ab_dir * dot / ab_len_sqr;
|
||||
}
|
||||
|
||||
bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p)
|
||||
|
|
@ -2349,7 +2348,7 @@ static bool NavMoveRequestButNoResultYet()
|
|||
return g.NavMoveRequest && g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0;
|
||||
}
|
||||
|
||||
static void NavMoveRequestCancel()
|
||||
void ImGui::NavMoveRequestCancel()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NavMoveRequest = false;
|
||||
|
|
@ -5006,7 +5005,7 @@ static void NavProcessMoveRequestWrapAround(ImGuiWindow* window)
|
|||
if ((g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) && g.NavMoveRequestForward == ImGuiNavForward_None && g.NavLayer == 0)
|
||||
{
|
||||
g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued;
|
||||
NavMoveRequestCancel();
|
||||
ImGui::NavMoveRequestCancel();
|
||||
g.NavWindow->NavRectRel[0].Min.y = g.NavWindow->NavRectRel[0].Max.y = ((g.NavMoveDir == ImGuiDir_Up) ? ImMax(window->SizeFull.y, window->SizeContents.y) : 0.0f) - window->Scroll.y;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue