Viewport: Moving a window accross viewports tries to preserve the dragging pivot (that is assuming that the window will be evenly scaled by DPI, aka Style is scaled). (#1542)

This commit is contained in:
omar 2018-04-05 11:40:33 +02:00
parent 9d8bc79025
commit c23b5463c7

View File

@ -13982,11 +13982,17 @@ static void ScaleWindow(ImGuiWindow* window, float scale)
void ImGui::ScaleWindowsInViewport(ImGuiViewportP* viewport, float scale)
{
ImGuiContext& g = *GImGui;
if (g.MovingWindow != NULL)
g.ActiveIdClickOffset = ImFloor(g.ActiveIdClickOffset * scale);
/*
if (g.IO.MousePosViewport == viewport->ID)
{
//g.IO.MousePos = g.IO.MousePosPrev = ImFloor((g.IO.MousePos - viewport->Pos) * scale) + viewport->Pos;
//g.IO.MouseDelta = ImVec2(0,0);
g.IO.MousePos = g.IO.MousePosPrev = ImFloor((g.IO.MousePos - viewport->Pos) * scale) + viewport->Pos;
g.IO.MouseDelta = ImVec2(0,0);
}
*/
if (viewport->Window)
{
ScaleWindow(viewport->Window, scale);