Fix viewport zoom repositioning ignoring map bounds

This commit is contained in:
Gustas
2025-12-29 16:51:40 +02:00
committed by Paul Chote
parent eb09870a10
commit c07af73eae

View File

@@ -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()