Moving window doesn't use accumulating MouseDelta so straying out of boundaries keeps moved window at the same spot.

This commit is contained in:
omar 2017-12-25 16:03:58 +01:00
parent 78f48bb795
commit 3849bb4470

View File

@ -2379,9 +2379,10 @@ void ImGui::NewFrame()
IM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId);
if (g.IO.MouseDown[0])
{
g.MovingWindow->RootWindow->PosFloat += g.IO.MouseDelta;
if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset;
if (g.MovingWindow->RootWindow->PosFloat.x != pos.x || g.MovingWindow->RootWindow->PosFloat.y != pos.y)
MarkIniSettingsDirty(g.MovingWindow->RootWindow);
g.MovingWindow->RootWindow->PosFloat = pos;
FocusWindow(g.MovingWindow);
}
else
@ -2930,6 +2931,7 @@ void ImGui::EndFrame()
g.MovingWindow = g.HoveredWindow;
g.MovingWindowMoveId = g.MovingWindow->MoveId;
SetActiveID(g.MovingWindowMoveId, g.HoveredRootWindow);
g.ActiveIdClickOffset = g.IO.MousePos - g.MovingWindow->RootWindow->Pos;
}
}
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)