Add smooth minimap to world movement

This commit is contained in:
Gustas
2025-09-11 13:21:21 +03:00
committed by Paul Chote
parent 1a8a3eca4d
commit 082f369fe3
3 changed files with 50 additions and 22 deletions

View File

@@ -250,7 +250,7 @@ namespace OpenRA.Graphics
public CPos ViewToWorld(int2 view)
{
var world = worldRenderer.Viewport.ViewToWorldPx(view);
var world = ViewToWorldPx(view);
var map = worldRenderer.World.Map;
var candidates = CandidateMouseoverCells(world).ToList();
@@ -337,6 +337,13 @@ namespace OpenRA.Graphics
allCellsDirty = true;
}
public void Center(float2 pos)
{
CenterLocation = worldRenderer.ScreenPosition(pos).Clamp(mapBounds);
cellsDirty = true;
allCellsDirty = true;
}
public void Scroll(float2 delta, bool ignoreBorders)
{
// Convert scroll delta from world-px to viewport-px