mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Nav: Fixed gamepad/keyboard moving of window affecting contents size incorrectly, sometimes leading to scrollbars appearing during the movement. + minor fix with the mostly dead Ctrl+wheel scaling.
This commit is contained in:
		| @@ -3330,7 +3330,7 @@ void ImGui::UpdateMouseWheel() | ||||
|  | ||||
|     // Zoom / Scale window | ||||
|     // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned. | ||||
|     if (g.IO.MouseWheel != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling) | ||||
|     if (g.IO.MouseWheel != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling && !window->Collapsed) | ||||
|     { | ||||
|         const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); | ||||
|         const float scale = new_font_scale / window->FontWindowScale; | ||||
| @@ -3338,7 +3338,7 @@ void ImGui::UpdateMouseWheel() | ||||
|         if (!(window->Flags & ImGuiWindowFlags_ChildWindow)) | ||||
|         { | ||||
|             const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; | ||||
|             window->Pos = ImFloor(window->Pos + offset); | ||||
|             SetWindowPos(window, window->Pos + offset, 0); | ||||
|             window->Size = ImFloor(window->Size * scale); | ||||
|             window->SizeFull = ImFloor(window->SizeFull * scale); | ||||
|         } | ||||
| @@ -8398,7 +8398,7 @@ static void ImGui::NavUpdateWindowing() | ||||
|         { | ||||
|             const float NAV_MOVE_SPEED = 800.0f; | ||||
|             const float move_speed = ImFloor(NAV_MOVE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y)); // FIXME: Doesn't code variable framerate very well | ||||
|             g.NavWindowingTarget->RootWindow->Pos += move_delta * move_speed; | ||||
|             SetWindowPos(g.NavWindowingTarget->RootWindow, g.NavWindowingTarget->RootWindow->Pos + move_delta * move_speed, ImGuiCond_Always); | ||||
|             g.NavDisableMouseHover = true; | ||||
|             MarkIniSettingsDirty(g.NavWindowingTarget); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user