mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Navigation: mouse/popup position gets clamped within visible display (#323)
This commit is contained in:
parent
0cc20fca83
commit
e74d96642f
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user