Skip to content

Commit

Permalink
Do not draw waypoints that are outside of the view
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Oct 6, 2024
1 parent 1cdc4c7 commit 200610d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/TSMapEditor/Rendering/MapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,15 @@ private void DrawWaypoint(Waypoint waypoint)
if (cell != null && !EditorState.Is2DMode)
drawPoint -= new Point2D(0, cell.Level * Constants.CellHeight);

if (Camera.TopLeftPoint.X > drawPoint.X + EditorGraphics.TileBorderTexture.Width ||
Camera.TopLeftPoint.Y > drawPoint.Y + EditorGraphics.TileBorderTexture.Height ||
GetCameraRightXCoord() < drawPoint.X ||
GetCameraBottomYCoord() < drawPoint.Y)
{
// This waypoint is outside the camera
return;
}

Color waypointColor = string.IsNullOrEmpty(waypoint.EditorColor) ? Color.Fuchsia : waypoint.XNAColor;

DrawTexture(EditorGraphics.GenericTileTexture, drawPoint.ToXNAPoint(), new Color(0, 0, 0, 128));
Expand Down

0 comments on commit 200610d

Please sign in to comment.