From 3d352563a84df6121ebb25e1febd98cccb841a65 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 7 Jun 2015 16:17:14 +0100 Subject: [PATCH] Allow scrolling to the map edges in the editor. --- OpenRA.Game/Graphics/Viewport.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 492797977d..cf5b369780 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -91,12 +91,12 @@ namespace OpenRA.Graphics { worldRenderer = wr; - // Calculate map bounds in world-px - var b = map.Bounds; + var cells = wr.World.Type == WorldType.Editor ? + map.AllCells : map.CellsInsideBounds; - // Expand to corners of cells - var tl = wr.ScreenPxPosition(map.CenterOfCell(new MPos(b.Left, b.Top).ToCPos(map)) - new WVec(512, 512, 0)); - var br = wr.ScreenPxPosition(map.CenterOfCell(new MPos(b.Right, b.Bottom).ToCPos(map)) + new WVec(511, 511, 0)); + // Calculate map bounds in world-px + var tl = wr.ScreenPxPosition(map.CenterOfCell(cells.TopLeft) - new WVec(512, 512, 0)); + var br = wr.ScreenPxPosition(map.CenterOfCell(cells.BottomRight) + new WVec(511, 511, 0)); mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y); maxGroundHeight = wr.World.TileSet.MaxGroundHeight;