From 87b17b8a10042e82d06097fc3e96d163e81729e9 Mon Sep 17 00:00:00 2001 From: Rampastring Date: Mon, 7 Oct 2024 01:42:00 +0300 Subject: [PATCH] Make cursor height preview dashed --- src/TSMapEditor/Rendering/MapView.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/TSMapEditor/Rendering/MapView.cs b/src/TSMapEditor/Rendering/MapView.cs index f945a6df..3bd1b362 100644 --- a/src/TSMapEditor/Rendering/MapView.cs +++ b/src/TSMapEditor/Rendering/MapView.cs @@ -1287,10 +1287,21 @@ private void DrawTileCursor(MapTile tileUnderCursor) int zoomedHeight = (int)(height * Camera.ZoomLevel); - Color heightBarColor = Color.Black * 0.25f; - Renderer.FillRectangle(new Rectangle((int)cellLeftPoint.X, (int)cellLeftPoint.Y, 1, zoomedHeight), heightBarColor); - Renderer.FillRectangle(new Rectangle((int)cellBottomPoint.X, (int)cellBottomPoint.Y, 1, zoomedHeight), heightBarColor); - Renderer.FillRectangle(new Rectangle((int)cellRightPoint.X, (int)cellRightPoint.Y, 1, zoomedHeight), heightBarColor); + Color heightBarColor = new Color(16, 16, 16, (int)byte.MaxValue) * 0.75f; + const int baseHeightLineSpaceAtBeginningOfStep = 6; + int heightLineSpaceAtBeginningOfStep = Camera.ScaleIntWithZoom(baseHeightLineSpaceAtBeginningOfStep); + int heightBarStep = Camera.ScaleIntWithZoom(Constants.CellHeight - baseHeightLineSpaceAtBeginningOfStep); + const int heightBarWidth = 2; + + int y = 0; + while (y < zoomedHeight - heightBarStep) + { + y += heightLineSpaceAtBeginningOfStep; + Renderer.FillRectangle(new Rectangle((int)cellLeftPoint.X - 1, (int)cellLeftPoint.Y + y, heightBarWidth, heightBarStep), heightBarColor); + Renderer.FillRectangle(new Rectangle((int)cellBottomPoint.X - 1, (int)cellBottomPoint.Y + y, heightBarWidth, heightBarStep), heightBarColor); + Renderer.FillRectangle(new Rectangle((int)cellRightPoint.X - 1, (int)cellRightPoint.Y + y, heightBarWidth, heightBarStep), heightBarColor); + y += heightBarStep; + } } private void DrawImpassableHighlight(MapTile cell)