From 200610d4fa562c48177ce35eb2882e1b2135abb9 Mon Sep 17 00:00:00 2001 From: Rampastring Date: Sun, 6 Oct 2024 23:18:34 +0300 Subject: [PATCH] Do not draw waypoints that are outside of the view --- src/TSMapEditor/Rendering/MapView.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/TSMapEditor/Rendering/MapView.cs b/src/TSMapEditor/Rendering/MapView.cs index be4281a3..fc9de9e9 100644 --- a/src/TSMapEditor/Rendering/MapView.cs +++ b/src/TSMapEditor/Rendering/MapView.cs @@ -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));