Replace CPos.CenterPosition -> Map.CenterOfCell.
This commit is contained in:
10
OpenRA.Game/Graphics/Viewport.cs
Executable file → Normal file
10
OpenRA.Game/Graphics/Viewport.cs
Executable file → Normal file
@@ -90,8 +90,10 @@ namespace OpenRA.Graphics
|
||||
|
||||
// Calculate map bounds in world-px
|
||||
var b = map.Bounds;
|
||||
var tl = wr.ScreenPxPosition(new CPos(b.Left, b.Top).TopLeft);
|
||||
var br = wr.ScreenPxPosition(new CPos(b.Right, b.Bottom).BottomRight);
|
||||
|
||||
// Expand to corners of cells
|
||||
var tl = wr.ScreenPxPosition(map.CenterOfCell(new CPos(b.Left, b.Top)) - new WVec(512, 512, 0));
|
||||
var br = wr.ScreenPxPosition(map.CenterOfCell(new CPos(b.Right, b.Bottom)) + new WVec(511, 511, 0));
|
||||
mapBounds = Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
|
||||
|
||||
CenterLocation = (tl + br) / 2;
|
||||
@@ -131,8 +133,8 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
get
|
||||
{
|
||||
var ctl = VisibleCells.TopLeft.TopLeft;
|
||||
var cbr = VisibleCells.BottomRight.BottomRight;
|
||||
var ctl = worldRenderer.world.Map.CenterOfCell(VisibleCells.TopLeft) - new WVec(512, 512, 0);
|
||||
var cbr = worldRenderer.world.Map.CenterOfCell(VisibleCells.BottomRight) + new WVec(511, 511, 0);
|
||||
var tl = WorldToViewPx(worldRenderer.ScreenPxPosition(ctl)).Clamp(ScreenClip);
|
||||
var br = WorldToViewPx(worldRenderer.ScreenPxPosition(cbr)).Clamp(ScreenClip);
|
||||
return Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y);
|
||||
|
||||
Reference in New Issue
Block a user