From 72ae6f52007bf92bc5182fc46a5db7fe4b6250a6 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 25 Sep 2023 14:41:48 +0200 Subject: [PATCH] Fixed MousePosPrev with has never been valid outside of NewFrame(). bed6ef03f always worked because it was done in NewFrame() before the assignment. --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 4e466557..3c0b5ac7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5082,6 +5082,7 @@ void ImGui::EndFrame() g.IO.Fonts->Locked = false; // Clear Input data for next frame + g.IO.MousePosPrev = g.IO.MousePos; g.IO.AppFocusLost = false; g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f; g.IO.InputQueueCharacters.resize(0); @@ -8670,7 +8671,6 @@ static void ImGui::UpdateMouseInputs() if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f) g.NavDisableMouseHover = false; - io.MousePosPrev = io.MousePos; for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) { io.MouseClicked[i] = io.MouseDown[i] && io.MouseDownDuration[i] < 0.0f;