From 30c04d0dbefb89822840b6dc71d43490fb14150c Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 21 Aug 2016 00:10:48 +0200 Subject: [PATCH] Nav: Mouse pos passed to backend always rounded, so that lossy application of non-integer mouse pos doesn't lead to undesirable movement (#3 --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 8d85c29ff..fccc7e2db 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2377,7 +2377,7 @@ static ImVec2 NavCalcPreferredMousePos() 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); + return ImFloor(ImClamp(p, r.Min, r.Max)); // ImFloor() is important because non-integer mouse position application in backend might be lossy and result in undesirable non-zero delta. } static int FindWindowIndex(ImGuiWindow* window) // FIXME-OPT O(N)