From c07af73eaefd535b3558c8119e365c36ac4e0b63 Mon Sep 17 00:00:00 2001 From: Gustas <37534529+PunkPun@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:51:40 +0200 Subject: [PATCH] Fix viewport zoom repositioning ignoring map bounds --- OpenRA.Game/Graphics/Viewport.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index afdb547bf0..50a2a018a1 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -108,7 +108,9 @@ namespace OpenRA.Graphics var oldCenter = worldRenderer.Viewport.ViewToWorldPx(center); AdjustZoom(dz); var newCenter = worldRenderer.Viewport.ViewToWorldPx(center); - CenterLocation += oldCenter - newCenter; + + var candidateCenterLocation = CenterLocation + oldCenter - newCenter; + CenterLocation = candidateCenterLocation.Clamp(mapBounds); } public void ToggleZoom()