Allow scrolling to the map edges in the editor.

This commit is contained in:
Paul Chote
2015-06-07 16:17:14 +01:00
parent 293c7fb840
commit 3d352563a8

View File

@@ -91,12 +91,12 @@ namespace OpenRA.Graphics
{ {
worldRenderer = wr; worldRenderer = wr;
// Calculate map bounds in world-px var cells = wr.World.Type == WorldType.Editor ?
var b = map.Bounds; map.AllCells : map.CellsInsideBounds;
// Expand to corners of cells // Calculate map bounds in world-px
var tl = wr.ScreenPxPosition(map.CenterOfCell(new MPos(b.Left, b.Top).ToCPos(map)) - new WVec(512, 512, 0)); var tl = wr.ScreenPxPosition(map.CenterOfCell(cells.TopLeft) - new WVec(512, 512, 0));
var br = wr.ScreenPxPosition(map.CenterOfCell(new MPos(b.Right, b.Bottom).ToCPos(map)) + new WVec(511, 511, 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); mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
maxGroundHeight = wr.World.TileSet.MaxGroundHeight; maxGroundHeight = wr.World.TileSet.MaxGroundHeight;