1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-01 10:47:24 +01:00

Navigation: mouse/popup position gets clamped within visible display (#323)

This commit is contained in:
ocornut 2016-07-23 19:42:19 +02:00
parent 0cc20fca83
commit e74d96642f

View File

@ -2270,9 +2270,11 @@ int ImGui::GetFrameCount()
static ImVec2 NavCalcPreferredMousePos()
{
ImGuiContext& g = *GImGui;
if (g.NavWindow)
return g.NavWindow->Pos + ImVec2(g.NavRefRectRel.Min.x + ImMin(g.Style.FramePadding.x*4, g.NavRefRectRel.GetWidth()), g.NavRefRectRel.Max.y - ImMin(g.Style.FramePadding.y, g.NavRefRectRel.GetHeight()));
return g.IO.MousePos;
if (!g.NavWindow)
return g.IO.MousePos;
ImVec2 p = g.NavWindow->Pos + ImVec2(g.NavRefRectRel.Min.x + ImMin(g.Style.FramePadding.x*4, g.NavRefRectRel.GetWidth()), g.NavRefRectRel.Max.y - ImMin(g.Style.FramePadding.y, g.NavRefRectRel.GetHeight()));
ImRect r = GetVisibleRect();
return ImClamp(p, r.Min, r.Max);
}
static void NavUpdate()