Allow scrolling to the map edges in the editor.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user