mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Navigation: mouse/popup position gets clamped within visible display (#323)
This commit is contained in:
		@@ -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()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user